# SINDy (Sparse Identification of Nonlinear Dynamics) algorithms

luckystarufo, updated 🕥 2022-12-08 01:27:46

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

## 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/
|- 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
|- 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: ```bash

pip install PySINDy ```

### Installing from source

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

git clone https://github.com/luckystarufo/pySINDy `Then, to install the package just type:`bash 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: ```bash

pytest pySINDy ```

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.

## Issues

### Bump certifi from 2018.11.29 to 2022.12.7

opened on 2022-12-08 01:27:46 by dependabot[bot]

Bumps certifi from 2018.11.29 to 2022.12.7.

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/luckystarufo/pySINDy/network/alerts).

### Bug with GeneralizedLibrary()

opened on 2022-09-22 14:53:24 by Volka007

Hello!

I found some annoying bug with GeneralizedLibrary(), we may see this into Example 15. When we use a 'tensor_array' it results in repeated features (see attached picture).

Then, if there are duplicate functions in the library, it may cause misidentification (see example):

The reason why it happens is pretty simple - because we use the bias term when build tensored library. From my point, it's needed to exclude the product of bias term with other terms from another feature library.

There is an obvious workarround: just do not use bias term with default library and use it as a single library.

Thank you!

### Bump nbconvert from 5.4.0 to 6.5.1

opened on 2022-08-23 17:28:39 by dependabot[bot]

Bumps nbconvert from 5.4.0 to 6.5.1.

Release notes

Sourced from nbconvert's releases.

## Release 6.5.1

No release notes provided.

## New Contributors

Full Changelog: https://github.com/jupyter/nbconvert/compare/6.4.5...6.5

## New Contributors

Full Changelog: https://github.com/jupyter/nbconvert/compare/6.4.2...6.4.3

## New Contributors

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/luckystarufo/pySINDy/network/alerts).

### Bump mistune from 0.8.4 to 2.0.3

opened on 2022-07-29 22:48:30 by dependabot[bot]

Bumps mistune from 0.8.4 to 2.0.3.

Release notes

Sourced from mistune's releases.

## Version 2.0.2

Fix `escape_url ` via lepture/mistune#295

## Version 2.0.1

Fix XSS for image link syntax.

## Version 2.0.0

First release of Mistune v2.

## Version 2.0.0 RC1

In this release, we have a Security Fix for harmful links.

## Version 2.0.0 Alpha 1

This is the first release of v2. An alpha version for users to have a preview of the new mistune.

Changelog

Sourced from mistune's changelog.

## Changelog

Here is the full history of mistune v2.

Version 2.0.4

``````
Released on Jul 15, 2022

Fix url plugin in &lt;a&gt; tag
Fix * formatting

``````Version 2.0.3
``````

Released on Jun 27, 2022

• Fix `table` plugin
• Security fix for CVE-2022-34749

Version 2.0.2

``````
Released on Jan 14, 2022
Fix escape_url
``````Version 2.0.1
``````

Released on Dec 30, 2021

XSS fix for image link syntax.

Version 2.0.0

``````
Released on Dec 5, 2021
This is the first non-alpha release of mistune v2.
``````Version 2.0.0rc1
``````

Released on Feb 16, 2021

Version 2.0.0a6

``````
</tr></table>
``````

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/luckystarufo/pySINDy/network/alerts).

### Bump numpy from 1.15.4 to 1.22.0

opened on 2022-06-21 21:34:21 by dependabot[bot]

Bumps numpy from 1.15.4 to 1.22.0.

Release notes

Sourced from numpy's releases.

# NumPy 1.22.0 Release Notes

NumPy 1.22.0 is a big release featuring the work of 153 contributors spread over 609 pull requests. There have been many improvements, highlights are:

• Annotations of the main namespace are essentially complete. Upstream is a moving target, so there will likely be further improvements, but the major work is done. This is probably the most user visible enhancement in this release.
• A preliminary version of the proposed Array-API is provided. This is a step in creating a standard collection of functions that can be used across application such as CuPy and JAX.
• NumPy now has a DLPack backend. DLPack provides a common interchange format for array (tensor) data.
• New methods for `quantile`, `percentile`, and related functions. The new methods provide a complete set of the methods commonly found in the literature.
• A new configurable allocator for use by downstream projects.

These are in addition to the ongoing work to provide SIMD support for commonly used functions, improvements to F2PY, and better documentation.

The Python versions supported in this release are 3.8-3.10, Python 3.7 has been dropped. Note that 32 bit wheels are only provided for Python 3.8 and 3.9 on Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and other Linux distributions dropping 32 bit support. All 64 bit wheels are also linked with 64 bit integer OpenBLAS, which should fix the occasional problems encountered by folks using truly huge arrays.

## Expired deprecations

### Deprecated numeric style dtype strings have been removed

Using the strings `"Bytes0"`, `"Datetime64"`, `"Str0"`, `"Uint32"`, and `"Uint64"` as a dtype will now raise a `TypeError`.

(gh-19539)

### Expired deprecations for `loads`, `ndfromtxt`, and `mafromtxt` in npyio

`numpy.loads` was deprecated in v1.15, with the recommendation that users use `pickle.loads` instead. `ndfromtxt` and `mafromtxt` were both deprecated in v1.17 - users should use `numpy.genfromtxt` instead with the appropriate value for the `usemask` parameter.

(gh-19615)

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/luckystarufo/pySINDy/network/alerts).

### Bump notebook from 6.1.5 to 6.4.12

opened on 2022-06-16 23:16:57 by dependabot[bot]

Bumps notebook from 6.1.5 to 6.4.12.

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/luckystarufo/pySINDy/network/alerts).
##### luckystarufo

I do data-driven physics and I am interested in understanding the mechanism of neural networks and analyzing nonlinear dynamics.