diff --git a/fastcan/narx/_base.py b/fastcan/narx/_base.py index fe95b83..1b6d0eb 100644 --- a/fastcan/narx/_base.py +++ b/fastcan/narx/_base.py @@ -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, @@ -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, @@ -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) diff --git a/fastcan/narx/_narx_fast.pyx b/fastcan/narx/_narx_fast.pyx index 0555ff3..a1e72e1 100644 --- a/fastcan/narx/_narx_fast.pyx +++ b/fastcan/narx/_narx_fast.pyx @@ -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. @@ -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. @@ -245,7 +243,6 @@ cpdef void _update_dydx( feat_ids, delay_ids, k, - num_threads, ) # Update constant terms of Jacobian diff --git a/pixi.lock b/pixi.lock index 5ae2194..35d0487 100644 --- a/pixi.lock +++ b/pixi.lock @@ -6125,7 +6125,7 @@ packages: - pypi: ./ name: fastcan version: 0.4.0 - sha256: 2a742d953b335411ce634a3753dbbbb11d5db7c54fee7d51fec056f5b77c9bf1 + sha256: 4d05a2e633ef9f1d71c13411129ce3652418f981abf09e090079a8609d632c14 requires_dist: - scikit-learn>=1.7.0,!=1.7.1 - furo ; extra == 'docs' diff --git a/pyproject.toml b/pyproject.toml index b386d6b..bb9d6e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "" } }