dynamicslab / pysindy

A package for the sparse identification of nonlinear dynamical systems from data
https://pysindy.readthedocs.io/en/latest/
Other
1.36k stars 304 forks source link

Make TrappingSR3 a subclass of ConstrainedSR3 #435

Closed Jacob-Stevens-Haas closed 2 months ago

Jacob-Stevens-Haas commented 7 months ago

This PR simplifies TrappingSR3, reducing it by about 250 lines. It changes the base class to ConstrainedSR3, deferring all calls to cvxpy to that superclass. It also makes the main algorithm clearer, so that its easier to see how different initialization arguments affect the choice of math involved (mostly because I couldn't quite understand this from the docstring). As a related effect, the _reduce method more closely matches the algorithm in the paper.

The plan is to eventually utilize superclass for combining and applying constraints, since that class is capable of doing both equality and inequality constraints, which will make it easier to include the constraints and helper functions of example 8 into trapping_sr3.py

codecov[bot] commented 7 months ago

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (2633ee0) 93.87% compared to head (639ea9d) 94.31%. Report is 1 commits behind head on master.

Files Patch % Lines
pysindy/optimizers/trapping_sr3.py 93.39% 7 Missing :warning:
pysindy/optimizers/constrained_sr3.py 93.75% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #435 +/- ## ========================================== + Coverage 93.87% 94.31% +0.43% ========================================== Files 37 37 Lines 3626 3554 -72 ========================================== - Hits 3404 3352 -52 + Misses 222 202 -20 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Jacob-Stevens-Haas commented 5 months ago

Preempted by #459 , converting back to draft.