eqdisco.dynamics.SINDy#

class eqdisco.dynamics.SINDy(degree=2, functions=(), library=None, method='stlsq', threshold=0.1, ridge=0.0, normalize=True, derivative_method='finite_difference', window=None, feature_names=None)[source]#

Bases: BaseEstimator

Sparse identification of nonlinear dynamics (Brunton, Proctor and Kutz, 2016).

Each derivative \(\dot z_i\) is regressed on a library \(\Theta(\mathbf Z)\) of candidate terms by a sparse solver.

Parameters:
degreeint, default=2

Degree of the polynomial library.

functionssequence of str, default=()

Unary functions of the states added to the library.

librarylist, optional

Explicit library (expressions or strings over the state and input names).

method{“stlsq”, “frols”, “lasso”}
thresholdfloat, default=0.1

STLSQ threshold (on coefficients scaled by the standard deviations of the term and of the derivative when normalize; on raw coefficients otherwise).

ridgefloat, default=0.0
normalizebool, default=True
derivative_method{“finite_difference”, “savgol”, “spline”}

Derivative estimate when t is given (finite differences, as in PySINDy; use "savgol" or "spline" for noisy data).

windowint, optional
feature_nameslist of str, optional

Names of the states (then of the inputs).

Attributes:
model_ODEModel
equations_list of Equation
coef_ndarray of shape (d, m)
terms_list of Expression
fit(Z, t=None, dZ=None, U=None)[source]#

Fit from states Z (T, d) and times t or derivatives dZ; U optional inputs.

predict(Z, U=None)[source]#

Derivatives predicted by the model.

score(Z, t=None, dZ=None, U=None)[source]#

Mean \(R^2\) of the derivatives.