In: Computer Science
Please explain the sparse identification of nonlinear dynamics (SINDy) with an example in Python or R
(Please put the code)
PySINDy is a Python package for the discovery of governing dynamical systems models from data. In particular, PySINDy provides tools for applying the sparse identification of nonlinear dynamics (SINDy) (Brunton et al. 2016) approach to model discovery. In this work we provide a brief description of the mathematical underpinnings of SINDy, an overview and demonstration of the features implemented in PySINDy (with code examples), practical advice for users, and a list of potential extensions to PySINDy.
It is a sparse regression package with several implementations for the Sparse Identification of Nonlinear Dynamical systems (SINDy) method introduced in Brunton et al. (2016), including the unified optimization approach of Champion et al. (2019) and SINDy with control from Brunton et al. (2016),
System identification - refers to the process of leveraging measurement data to infer governing equations, in the form of dynamical systems, describing the data. Once discovered, these equations can make predictions about future states, can inform control inputs, or can enable the theoretical study using analytical techniques. Dynamical systems are a flexible, well-studied class of mathematical objects for modeling systems evolving in time. SINDy is a model discovery method which uses sparse regression to infer nonlinear dynamical systems from measurement data. The resulting models are inherently interpretable and generalizable.
EXAMPLE-
import numpy as np import pysindy as ps t = np.linspace(0, 1, 100) x = 3 * np.exp(-2 * t) y = 0.5 * np.exp(t) X = np.stack((x, y), axis=-1) # First column is x, second is y
To instantiate a SINDy object with the default differentiation method, feature library, and optimizer and then fit it to the data, we invoke
model = ps.SINDy(feature_names=["x", "y"]) model.fit(X, t=t)
We use the feature_names argument so that the model prints out the correct labels for x and y. We can inspect the governing equations discovered by the model and check whether they seem reasonable with the print function.
model.print()
which prints the following
x' = -2.000 x y' = 1.000 y