dynamicslab / pysindy

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

SparseNonLinearModel for poly_order >=3 #378

Closed rochabm closed 1 year ago

rochabm commented 1 year ago

I would like to have support for this SparseNonLinearModel class for poly_orders greater than 3. Is there a quick way around to get that by myself?

Jacob-Stevens-Haas commented 1 year ago

Are you asking for SINDy(feature_library=PolynomialLibrary(degree=k)) for k>3?

rochabm commented 1 year ago

I guess yes. Sorry, for my confusion, but in fact I am using dyn-opt package (https://github.com/billtubbs/dyn-opt) which encapsulates SINDy for handling problems with forcing terms, and their class SparseNonLinearModel has the limitation of poly_order up to 3.

I did not find any working example in PySINDy to working with sparse identification considering forcing terms, then I had to start with this dyn-opt package.

Maybe. this is a limitation (dyn-opt) from their library, right?

Jacob-Stevens-Haas commented 1 year ago

That package doesn't import pysindy. It's an entirely separate implementation.

rochabm commented 1 year ago

OK! Thank you so much for your kind attention. Is there an example of the pysindy implementation working with forcing terms? I missed that, although I was able to find the theoretical papers on that, but not on the library.

Jacob-Stevens-Haas commented 1 year ago

Treat t like a control variable and add forcing terms to your feature_library. You can use GeneralizedLibrary to combine a separate library for field terms and forcing terms, and even use a ConstrainedSR3 optimizer if you know the coefficient of the forcing terms.

There should be examples of all three of these in ./examples/1_feature_overview/example.ipynb. Hope this helps!