Skip to main content

Sparse Identification of Nonlinear Dynamics

Project description

BuildCI Documentation Status PyPI Codecov JOSS1 JOSS2 DOI

PySINDy is a package for system identification, primarily revolving around the method of Sparse Identification of Nonlinear Dynamical systems (SINDy) method introduced in Brunton et al. (2016a). It also includes other methods from related literature.

System identification refers to the process of using measurement data to infer the governing dynamics. Once discovered, these equations can make predictions about future states, can inform control inputs, or can enable the theoretical study using analytical techniques. The resulting models are inherently interpretable and generalizable.

First Steps

Installation

The preferred way to install is with pip or conda e.g. pip install pysindy. You may have to add the --user option. Pysindy also provides several extras, e.g. pip install pysindy[miosr]:

cvxpy

Convex optimizer SR3 and subclasses

miosr

Branch-and-bound optimizer for L0-constraint, MIOSR

sbr

Bayesian regression optimizer yielding posteriors, SBR.

Example

Suppose we have measurements of the position of a particle obeying the following dynamical system at different points in time

\begin{align*} x' &= -2 x \\ y' &= y \end{align*}

Note that this system of differential equations decouples into two differential equations whose solutions are simply

\begin{align*} x(t) &= x_0 * exp(-2 * t) \\ y(t) &= y_0 * exp(t) \end{align*}

This example uses the initial conditions x_0 = 3 and y_0 = 0.5. It then fits and prints the discovered model

import numpy as np
import pysindy as ps

t = np.linspace(0, 1, 100)
x = 3 * np.exp(-2 * t)
y = 0.5 * np.exp(t)
X = np.stack((x, y), axis=-1)  # First column is x, second is y

model = ps.SINDy()
model.fit(X, t=t, feature_names=["x", "y"])
model.print()

which correctly results in

x' = -2.000 x
y' = 1.000 y

PySINDy provides numerous other features not shown here. We have a variety of tutorials and examples, starting with generating data and fitting models.

Getting Help

  • If you have a question or find a bug, please open an issue on github.

  • The documentation site for PySINDy can be found here. A video overview of PySINDy can be found on Youtube. We have also created a video playlist with practical PySINDy tips.

  • To understand more about the types of objects in pysindy, see the object model.

  • If you want to fix a problem, add a feature, or share an example, check the **Contributor** Guide.

  • If you are using pysindy in academic work, please see Academic Use for recommendations, including citations.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysindy-2.1.0.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysindy-2.1.0-py3-none-any.whl (123.4 kB view details)

Uploaded Python 3

File details

Details for the file pysindy-2.1.0.tar.gz.

File metadata

  • Download URL: pysindy-2.1.0.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysindy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 369659db632e72e670b64cfd79fd3c0b9efc8e3a36f0c35f4f11b844e863bb08
MD5 8357ee3317df3956607047c5fa45605c
BLAKE2b-256 d7ef5765d83e6ea76442bffbd083e6009ef7825202a624886b2efb3fbce4acdb

See more details on using hashes here.

File details

Details for the file pysindy-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysindy-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 123.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysindy-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b75c1bc760b728eac52a42ee3e3dd97454175e49df29124740ea7dee43a8be39
MD5 2f49a35d4c152ed97ce72424a45c0007
BLAKE2b-256 c78d46455f0b58eba0044edb48c6bd495455c1d6f1872a701e5a4fb94f93618d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page