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

Unify constraint-based methods, minimize trapping class, add helper functions #427

Open Jacob-Stevens-Haas opened 8 months ago

Jacob-Stevens-Haas commented 8 months ago

Currently, there are two ways of enforcing stability in discovered models: StabilizedLinearSR3 and TrappingSR3. The latter requires two manual steps: adding constraints from the make_constraints function in example 8, and strengthening the default regularization $`/\eta$ from 1e-20 to something larger.

A few other issues I see:

I am starting to slim down what TrappingSR3 does, offloading work to the superclass. This will make all the follow-on work easier. But before I do all this, I wanted to hear from @MPeng5 what your plans were as they relate to library design.

Jacob-Stevens-Haas commented 8 months ago

What is the point of test_trapping_cubic_library()? Doesn't the trapping theorem require quadratic polynomials?

Also, does the ordering in PolynomialLibrary not match the ordering in make_constraints()? In Example 8, there's this nugget:

# Initialize quadratic SINDy library, with custom ordering 
# to be consistent with the constraint
library_functions = [lambda x:x, lambda x, y:x * y, lambda x:x ** 2]
library_function_names = [lambda x:x, lambda x, y:x + y, lambda x:x + x]
sindy_library = ps.CustomLibrary(library_functions=library_functions, 
                                 function_names=library_function_names)
MPeng5 commented 6 months ago

@Jacob-Stevens-Haas Sorry Jacob, I was quite busy then but please let me join the discussion now. We come up with a new theorem which allows us to get rid of the make_constraints() in my version of Trapping. So let me know what your plan is right now. and as i mentioned from the other thread, we can discuss this on campus sometime.