Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions fastcan/narx/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from sklearn.base import BaseEstimator, MultiOutputMixin, RegressorMixin
from sklearn.linear_model import LinearRegression
from sklearn.utils import check_array, check_consistent_length, column_or_1d
from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
from sklearn.utils._param_validation import Interval, StrOptions, validate_params
from sklearn.utils.validation import (
_check_sample_weight,
Expand Down Expand Up @@ -493,9 +492,9 @@ def _grad(
else:
n_x = n_coefs
y_ids = output_ids

dydx = np.zeros((n_samples, n_outputs, n_x), dtype=float)
dcf = np.zeros((max_delay, n_outputs, n_outputs), dtype=float)
n_threads = _openmp_effective_n_threads()

_update_dydx(
X,
Expand All @@ -510,7 +509,6 @@ def _grad(
grad_feat_ids,
dydx,
dcf,
n_threads,
)

mask_valid = mask_missing_values(y, y_hat, sample_weight_sqrt, return_mask=True)
Expand Down
3 changes: 0 additions & 3 deletions fastcan/narx/_narx_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ cdef inline void _update_terms(
const int[:, ::1] feat_ids, # IN
const int[:, ::1] delay_ids, # IN
const int k, # IN
const int num_threads, # IN
) noexcept nogil:
"""
Evaluate all terms for the given features and delays at timestep k.
Expand Down Expand Up @@ -195,7 +194,6 @@ cpdef void _update_dydx(
const int[:, ::1] grad_feat_ids,
double[:, :, ::1] dydx, # OUT
double[:, :, ::1] dcf, # OUT
const int num_threads, # IN
) noexcept nogil:
"""
Computation of the Jacobian matrix dydx.
Expand Down Expand Up @@ -245,7 +243,6 @@ cpdef void _update_dydx(
feat_ids,
delay_ids,
k,
num_threads,
)

# Update constant terms of Jacobian
Expand Down
2 changes: 1 addition & 1 deletion pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ time-h = "python -m timeit -n 5 -s 'import numpy as np; from fastcan import Fast
time-eta = "python -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, eta=True, verbose=0).fit(X, y)'"
profile-minibatch = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan import minibatch; X = np.random.rand(100, 3000); y = np.random.rand(100, 20); cProfile.run('minibatch(X, y, 1000, 10, verbose=0)', sort='$SORT')"''', env = { SORT = "cumtime" } }
time-narx = '''python -m timeit -n 1 -s "import numpy as np; from fastcan.narx import make_narx; rng = np.random.default_rng(5); X = rng.random((1000, 10)); y = rng.random((1000, 2)); m = make_narx(X, y, 10, max_delay=2, poly_degree=2, verbose=0)" "m.fit(X, y, coef_init='one_step_ahead', verbose=1)"'''
profile-narx = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan.narx import make_narx; X = np.random.rand(3000, 3); y = np.random.rand(3000, 3); m = make_narx(X, y, 10, max_delay=10, poly_degree=2, verbose=0); cProfile.run('m.fit(X, y, coef_init=[0]*33)', sort='$SORT')"''', env = { SORT = "tottime" } }
profile-narx = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan.narx import make_narx; rng = np.random.default_rng(8); X = rng.random((3000, 3)); y = rng.random((3000, 3)); m = make_narx(X, y, 10, max_delay=10, poly_degree=2, verbose=0); cProfile.run('m.fit(X, y, coef_init=[0]*33)', sort='$SORT')"''', env = { SORT = "tottime" } }

[tool.pixi.feature.asv.tasks]
asv-build = { cmd = "python -m asv machine --machine $MACHINE --yes && python -m asv run --show-stderr -v --machine $MACHINE $EXTRA_ARGS", cwd = "asv_benchmarks", env = { MACHINE = "MacOS-M1", EXTRA_ARGS = "" } }
Expand Down
Loading