-
Notifications
You must be signed in to change notification settings - Fork 355
Separate DiscreteSINDy as a new class #654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…atibility with multiple trajectories for DiscreteSINDy
|
The |
|
Part of the problem with the face-to-face conversations is that I can't remember them. Refresh my memory. What was the issue removing the parameter |
|
Removing |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #654 +/- ##
==========================================
- Coverage 95.03% 94.85% -0.18%
==========================================
Files 38 38
Lines 4106 4138 +32
==========================================
+ Hits 3902 3925 +23
- Misses 204 213 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Do we need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
90% of the way there, thanks for this long work!
Few changes, few nits, few documentation/test things
|
|
||
| # Compute derivatives with a finite difference method, for comparison | ||
| x_dot_test_computed = model.differentiate(x_test, t=dt) | ||
| x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_differentiate is private - we can't show that in a tutorial.
| x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt) | |
| x_dot_test_computed = model.differentiation_method(x_test, t=dt) |
|
|
||
| # Compute derivatives with a finite difference method, for comparison | ||
| x_dot_test_computed = model.differentiate(x_test, t=dt) | ||
| x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt) | |
| x_dot_test_computed = model.differentiation_method(x_test, t=dt) |
|
|
||
| # Compute derivatives with a finite difference method, for comparison | ||
| x_dot_test_computed = model.differentiate(x_test, t=dt) | ||
| x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt) | |
| x_dot_test_computed = model.differentiation_method(x_test, t=dt) |
| for i in range(1, n_steps): | ||
| x_train_map[i] = f(x_train_map[i - 1]) + eps * np.random.randn() | ||
| model = ps.SINDy(discrete_time=True) | ||
| model = ps.DiscreteSINDy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the two discrete examples from feature overview, keep them in the docstring for DiscreteSINDy.
Use the sphinx extension matplotlib.sphinxext.plot_directive to show the plots in the DiscreteSINDy documentation
|
|
||
| feature_library: BaseFeatureLibrary | ||
| optimizer: _BaseOptimizer | ||
| discrete_time: bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
| return self.optimizer.coef_ | ||
|
|
||
| def equations(self, precision: int = 3) -> list[str]: | ||
| def equations(self, precision: int = 3, discrete_time=False) -> list[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Override this function, don't add parameters.
| if sys.version_info.minor < 10: | ||
| mixed_trajectories = ( | ||
| isinstance(x, Sequence) | ||
| and ( | ||
| not isinstance(x_dot, Sequence) | ||
| and x_dot is not None | ||
| or not isinstance(u, Sequence) | ||
| and u is not None | ||
| ) | ||
| or isinstance(x_dot, Sequence) | ||
| and not isinstance(x, Sequence) | ||
| or isinstance(u, Sequence) | ||
| and not isinstance(x, Sequence) | ||
| ) | ||
| else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.9 reached EOL, require 3.10 in pyproject.toml and remove this condition
This PR separates
DiscreteSINDyas a new class that derives from_BaseSINDyfollowing the discussion in #351.Also fixes #650.