PySINDy Examples
This directory showcases the following examples of PySINDy in action.
Feature overview
This notebook gives an almost exhaustive overview of the different features available in PySINDy. It’s a good reference for how to set various options and work with different types of datasets.
Introduction to SINDy
We recommend that people new to SINDy start here. We give a gentle introduction to the SINDy method and how different steps in the algorithm are represented in PySINDy. We also show how to use PySINDy to learn a model for a simple linear differential equation.
Original paper
This notebook uses PySINDy to reproduce the examples in the original SINDy paper. Namely, it applies PySINDy to the following problems:
Linear 2D ODE
Cubic 2D ODE
Linear 3D ODE
Lorenz system
Fluid wake behind a cylinder
Logistic map
Hopf system
Scikit-learn compatibility
Shows how PySINDy interfaces with various Scikit-learn objects.
Cross-validation
Sparse regressors
Differentiation
Explore the differentiation methods available in PySINDy on pure differentiation problems and as components in the SINDy algorithm.
Deeptime compatibility
See a demonstration of PySINDy objects designed to conform to the Deeptime API.
Plasma physics
Use the ConstrainedSR3
optimizer to build a constrained model for the temporal POD modes of a plasma simulation.
Trapping SINDy
This notebook applies the TrappingSR3
optimizer to various canonical fluid systems., proposed in this paper: Kaptanoglu, Alan A., et al. “Promoting global stability in data-driven models of quadratic nonlinear dynamics.” Physical Review Fluids 6.9 (2021): 094401. A preprint is found here https://arxiv.org/abs/2105.01843.
SINDyPI
This notebook applies the SINDyPI
optimizer to a simple implicit ODE and was originally proposed in this paper: Kaheman, Kadierdan, J. Nathan Kutz, and Steven L. Brunton. “SINDy-PI: a robust algorithm for parallel implicit sparse identification of nonlinear dynamics.” Proceedings of the Royal Society A 476.2242 (2020): 20200279.
PDEFIND
This notebook applies the PDEFIND algorithm (SINDy for PDE identification) to a number of PDEs, and was originally proposed in this paper: Rudy, Samuel H., et al. “Data-driven discovery of partial differential equations.” Science Advances 3.4 (2017): e1602614.
Greedy Algorithms
This notebook uses the step-wise sparse regression (SSR) and forward-regression orthogonal least-squares (FROLS) algorithms, which are greedy algorithms that iteratively truncate (or add) one nonzero coefficient at each algorithm iteration.
Weak formulation SINDy
This notebook uses SINDy to identify the weak-formulation of a system of ODEs or PDEs, adding significant robustness against noise in the data.
Model ensembles
This notebook uses sub-sampling of the data and sub-sampling of the SINDy library to generate many models, and the user can choose how to average or otherwise combine these models together. This tends to make SINDy more robust against noisy data.
Cavity flow
Demonstrates the use of SINDy to learn a model for the quasiperiodic dynamics in a shear-driven cavity at Re=7500, following Callaham, Brunton, and Loiseau (2021), preprint available here https://arxiv.org/pdf/2106.02409.
PySINDy lectures
Lectures on PySINDy usage from Alan Kaptanoglu’s Youtube channel: https://www.youtube.com/playlist?list=PLN90bHJU-JLoOfEk0KyBs2qLTV7OkMZ25.
Noise robustness benchmarking
Benchmarking PySINDy on low dimensional chaotic systems subject to noise, following Kaptanoglu, Zhang, Nicolaou, Fasel, & Brunton, (2023), preprint available here https://arxiv.org/abs/2302.10787.
Parameterized pattern formation
Demonstrates the use of SINDyCP for discovery of parameterized pattern formation, following Nicolaou, Huo, Chen, Kutz, and Bruton (2023), preprint available here https://arxiv.org/abs/2301.02673.
All examples including examples under development
- PDEFIND Feature Overview
- Define Algorithm 2 from Rudy et al. (2017)
- Test PDE functionality on the 1D kdV equation
- Test spatial derivative computations
- Test PDE functionality on the Kuramoto-Sivashinsky equation
- Test PDE functionality on Burgers’ equation
- Test PDE functionality on 2D Reaction-Diffusion system
- Test PDE functionality on 3D Reaction-Diffusion system
- SSR and FROLs (the greedy algorithms!) examples
- Define some functions for plotting performance as the greedy algorithms progress
- Note that the usage is a bit different because we save all the sparse models and we choose our favorite one afterwards. Below we show that we can track the MSE between the predicted and true derivative on a testing trajectory as the algorithm iterates, and then choose the model with the minimum MSE.
- Let’s compare all three methods as the noise steadily increases, cross-validated over 10 noise instantiations
- Summary
- Weak/Integral SINDy Feature Overview
- Test weak form ODE functionality on Lorenz equation
- Test weak form PDE functionality on Burgers’ equation with 20% noise
- Test weak form PDE functionality on 2d compressible isothermal flow equations with mixed function-derivative terms
- Test weak-formulation PDE functionality on the Kuramoto-Sivashinsky equation
- Test weak form PDE functionality on Reaction-Diffusion system
- Test weak form PDE functionality on 3D Reaction-Diffusion system
- Ensembling Feature Overview
- Quasiperiodic cavity flow
- 6. Manifold SINDy
- Summary of PySINDy YouTube tutorial videos
- Part 1: How to choose algorithm hyperparameters such as \(\lambda\)?
- Part 2: How to make SINDy more robust for system identification?
- Part 3a: Implicit ODEs
- Part 3b: Identifying partial differential equations (PDEs)
- Part 4: How to choose a regularizer and a sparse regression algorithm?
- Part 5: How to build complex candidate libraries
- Large-scale benchmarking for system identification methods
- Trajectory Visualization
- SINDyCP Feature Overview
- SINDy-POD models for viscoelastic flows
- Make sure that eigenvalues of the final model coefficients are all negative
- Stability guarantee means we can simulate with new initial conditions
- Bayesian UQ-SINDy
- Feature Overview
- An introduction to Sparse Identification of Nonlinear Dynamical systems (SINDy)
- Original Paper: Sparse Identification of Nonlinear Dynamical systems (SINDy)
- Working with Scikit-learn
- Compare differentiation methods directly
- Compare differentiators when used in PySINDy
- Deeptime objects
- Plasma physics
- Trapping SINDy
- Mean field model
- Atmospheric oscillator model
- Lorenz model
- Visualizing the trapping region for Lorenz
- MHD model
- Forced Burger’s Equation
- Von Karman shedding behind circular cylinder, Re = 100
- Comparing 3D trajectories with the POD-Galerkin model
- Energy plot illustrating the transient and long-time energy conservation
- Plot \(u(x,y,t)\) reconstructions and modes
- SINDy-PI Feature Overview