SINDy#
- class SINDy(library, output_dimension)[source]#
Bases:
ModuleSINDy model class.
The Sparse Identification of Nonlinear Dynamics (SINDy) model identifies the governing equations of a dynamical system from data by learning a sparse linear combination of non-linear candidate functions.
The output of the model is expressed as product of a library matrix and a coefficient matrix:
\[\dot{X} = \Theta(X) \Xi\]- where:
\(X \in \mathbb{R}^{B \times D}\) is the input snapshots of the system state. Here, \(B\) is the batch size and \(D\) is the number of state variables.
\(\Theta(X) \in \mathbb{R}^{B \times L}\) is the library matrix obtained by evaluating a set of candidate functions on the input data. Here, \(L\) is the number of candidate functions in the library.
\(\Xi \in \mathbb{R}^{L \times D}\) is the learned coefficient matrix that defines the sparse model.
See also
Original reference: Brunton, S.L., Proctor, J.L., and Kutz, J.N. (2016). Discovering governing equations from data: Sparse identification of non-linear dynamical systems. Proceedings of the National Academy of Sciences, 113(15), 3932-3937. DOI: 10.1073/pnas.1517384113
Initialization of the
SINDyclass.- Parameters:
library (list[Callable]) – The collection of candidate functions used to construct the library matrix. Each function must accept an input tensor of shape
[..., D]and return a tensor of shape[..., 1].output_dimension (int) – The number of output variables, typically the number of state derivatives. It determines the number of columns in the coefficient matrix.
- Raises:
ValueError – If
libraryis not a list of callables.AssertionError – If
output_dimensionis not a positive integer.
- forward(x)[source]#
Forward pass of the
SINDymodel.- Parameters:
x (torch.Tensor) – The input batch of state variables.
- Returns:
The predicted time derivatives of the state variables.
- Return type:
- property library#
The library of candidate functions.
- Returns:
The library.
- Return type:
list[Callable]
- property coefficients#
The coefficients of the model.
- Returns:
The coefficients.
- Return type: