Skip to content

Commit

Permalink
Merge pull request #207 from dynamicslab/fix-set-params
Browse files Browse the repository at this point in the history
BUG: SINDyDerivative set_params() missed sklearn interface
  • Loading branch information
akaptano committed Jun 21, 2022
2 parents cbe47de + 7b16aec commit a7f94bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pysindy/differentiation/sindy_derivative.py
Expand Up @@ -52,7 +52,7 @@ def set_params(self, **params):
# Simple optimization to gain speed (inspect is slow)
return self
else:
self.kwargs.update(params)
self.kwargs.update(params["kwargs"])

return self

Expand Down
7 changes: 7 additions & 0 deletions test/differentiation/test_differentiation_methods.py
Expand Up @@ -262,6 +262,13 @@ def test_wrapper_equivalence_with_dxdt(data, derivative_kws):
)


def test_sindy_derivative_kwarg_update():
method = SINDyDerivative(kind="spectral", foo=2)
method.set_params(kwargs={"kind": "spline", "foo": 1})
assert method.kwargs["kind"] == "spline"
assert method.kwargs["foo"] == 1


@pytest.mark.parametrize(
"data, derivative_kws",
[
Expand Down

0 comments on commit a7f94bf

Please sign in to comment.