PySINDy – A package for the sparse identification of nonlinear dynamical systems
PySINDy: Sparse Identification of Nonlinear Dynamical Systems
Overview
PySINDy is a specialized Python library designed for system identification. It is built primarily around the Sparse Identification of Nonlinear Dynamical systems (SINDy) framework, as originally proposed by Brunton et al.
What is System Identification? It is the methodology of utilizing observed measurement data to deduce the underlying governing dynamics of a system.
By uncovering these equations, researchers can:
- Generate predictions regarding future system states.
- Develop informed control inputs.
- Conduct theoretical analysis using analytical tools.
Unlike black-box machine learning models, the resulting models from PySINDy are inherently generalizable and interpretable.
The SINDy Workflow
Getting Started
Installation
The most efficient way to install the package is via pip or conda. To include optional optimizers, use the following command:
pip install pysindy[miosr]
Optimizer Options
Depending on your needs, you can utilize different optimization backends:
| Optimizer | Backend/Method | Purpose |
|---|---|---|
cvxpy | Convex Optimizer | Standard convex optimization |
miosr | Branch-and-bound | -constraint optimization |
sbr | Bayesian Regression | Yields posterior distributions |
Practical Example
Imagine we are tracking a particle's position governed by the following system of differential equations:
This system is decoupled, meaning the solutions are simply:
Using initial conditions and , we can use PySINDy to recover the model:
import numpy as np
import pysindy as ps
# Assume x and y are arrays of measurement data
# Stack data: first column x, second column y
X = np.stack((x, y), axis=-1)
# Initialize and fit the model
model = ps.SINDy().fit(X, t=t)
model.print()
Expected Output:
x' = -2.000 x
y' = 1.000 y
Resources & Support
If you are new to the library, consider the following checklist:
- Explore the tutorials and examples for data generation and model fitting.
- Review the object model to understand the internal architecture.
- Watch the video playlist for practical implementation tips.
Community & Contribution
- Issues: Found a bug or have a question? Please open a GitHub issue.
- Contributing: To add features or fix bugs, refer to the Contributor Guide.
- Academic Use: For citations and recommendations regarding scholarly work, see the Academic Use section.
The Ecosystem: Related Packages
PySINDy is part of a broader suite of tools for dynamical systems analysis:
- Deeptime: Focused on time series analysis, including Markov model estimation, clustering, and dimension reduction.
- PyDMD: Implements Dynamic Mode Decomposition for simplifying data-driven models via spatiotemporal structures.
- SEED: A graphical user interface (GUI) that provides a visual wrapper for many
PySINDymethods. - SymINDy: Integrates SINDy with symbolic regression (genetic programming) to optimize function libraries.
- derivative: A utility package used by
PySINDyfor data smoothing and differentiation.