Skip to content

SINDy (Sparse Identification of Nonlinear Dynamics) algorithms

License

Notifications You must be signed in to change notification settings

luckystarufo/pySINDy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Sparse Identification of Nonelinear Dynamics

PyPI version

NOTICE: This repository is deprecated. The new (official) version of PySindy is available here: https://github.com/dynamicslab/pysindy.

pySINDy: python Sparse Identification of Nonlinear Dynamics

Table of contents

Introduction

PySINDy is a Python package that implements the SINDy-family algorithms. SINDy is short for "Sparse Identification of Nonlinear Dynamics", which is a class of data-driven algorithms for system identification. This class of algorithms are mainly developed by Steve Brunton and Nathan Kutz at the University of Washington. Since then, many variants arose, such as SINDy for PDEs, implicit SINDy, parametric SINDy, Hybrid SINDy, SINDy with control, etc. In PySINDy, we will (or we will try our best to) implement the majority of the variants with a friendly user interface, see the Examples section for more details.

The idea behind the SINDy algorithm is not terribly new. To simply put it, it just automatically calculate some spatial and temporal derivatives from some high-fidelity measurements data and does a sparse regression of some sort. In other words, you feed it with some time series measurements, then it provides you a differential equation model with sparse coefficients. (Why sparse? It is just an assumption on 'parsimony'!)

One last note: From our experience, the algorithms do rely on high-fidelity measurements so that it calculates the right 'derivatives'. If you have nosiy data, please preprocess first and then use the algorithm, or you can try to calculate the derivatives with some interpolation methods to reduce the noise effects. We may also add some features on that later.

Structure

pySINDy/
  |- README.md
  |- datasets
     |- burgers.mat
     |- reaction_diffusion.mat
     |- ...
  |- env
     |- ...
  |- pySINDy/
     |- __init__.py
     |- sindybase.py
     |- sindy.py
     |- isindy.py
     |- sindypde.py
     |- data/
        |- ...
     |- tests/
        |- ...
     |- utils/
        |- generator.py
  |- examples
     |- example-1-sindy-vanderpol.ipynb
     |- example-2-sindypde-burgers.ipynb
     |- example-3-sindypde-reactiondiffusion.ipynb
     |- example-4-isindy-subtilis_competence.ipynb
  |- docs/
     |- Design Doc.pdf
     |- Makefile
     |- make.bat
     |- build/
        |- ...
     |- source/
        |- _static
        |- _summaries
        |- conf.py
        |- index.rst
        |- ...
  |- setup.py
  |- .gitignore
  |- .travis.yml
  |- LICENSE
  |- requirements.txt

Getting Started

PySINDy requires numpy, scipy, matplotlib, findiff, pytest (for unittests), pylint (for PEP8 style check), sphinx (for documentation). The code is compatible with Python 3.5 and Python 3.6. It can be installed using pip or directly from the source code.

Installing via pip

Mac and Linux users can install pre-built binary packages using pip. To install the package just type:

> pip install PySINDy

Installing from source

The official distribution is on GitHub, and you can clone the repository using:

> git clone https://github.com/luckystarufo/pySINDy

Then, to install the package just type:

> python setup.py install

Usage

PySINDy uses Sphinx for code documentation. So you can see more details about the code usage there.

Examples

We will frequently update simple examples for demo purposes, and here are currently exisiting ones:

  1. SINDy: Van Der Pol Oscillator
  2. SINDyPDE: Burgers Equation
  3. SINDyPDE: Reaction Diffusion
  4. ISINDy example

Running the tests

We are using Travis CI for continuous intergration testing. You can check out the current status here.

To run tests locally, type:

> pytest pySINDy

License

This project utilizes the MIT LICENSE. 100% open-source, feel free to utilize the code however you like.

Acknowledgments

PySINDy is primarily developed for CSE 583 - Software Development for Data Scientist at the University of Washington, so special thanks to the instructors David A. C. Beck, Joseph L. Hellerstein, Bernease Herman and Colin Lockard. And of course, special thanks to two other contributors (my teammates: Yi Chu and Lianzong Wang), who contributed a lot in implementing some of the algorithms, performing unittests as well as benchmarking.