Python package for data-driven approximations to the Koopman operator.
Project description
PyKoopman is a Python package for computing data-driven approximations to the Koopman operator.
Data-driven approximation of Koopman operator
Given a nonlinear dynamical system,
the Koopman operator governs the temporal evolution of the measurement function. Unfortunately, it is an infinite-dimensional linear operator. Most of the time, one has to project the Koopman operator onto a finite-dimensional subspace that is spanned by user-defined/data-adaptive functions.
If the system state is also contained in such subspace, then effectively, the nonlinear dynamical system is (approximately) linearized in a global sense.
Schematic of data-driven approximation of Koopman operator
The goal of data-driven approximation of Koopman operator is to find such a set of functions that span such lifted space and the transition matrix associated with the lifted system.
Structure of PyKoopman
PyKoopman package is centered around the Koopman class and KoopmanContinuous class. It consists of two key components
observables: a set of observables functions, which spans the subspace for projection.
regressor: the optimization algorithm to find the best fit for the projection of Koopman operator.
After Koopman/KoopmanContinuous object has been created, it must be fit to data, similar to a scikit-learn model. We design PyKoopman such that it is compatible to scikit-learn objects and methods as much as possible.
Example
1. Learning how to create observables
2. Learning how to compute time derivatives
3. Dynamic mode decomposition on two mixed spatial signals
4. Dynamic mode decomposition with control on a 2D linear system
5. Dynamic mode decomposition with control (DMDc) for a 128D system
6. Dynamic mode decomposition with control on a high-dimensional linear system
7. Successful examples of using Dynamic mode decomposition on PDE system
8. Unsuccessful examples of using Dynamic mode decomposition on PDE system
9. Extended DMD for Van Der Pol System
10. Learning Koopman eigenfunctions on Slow manifold
11. Comparing DMD and KDMD for Slow manifold dynamics
12. Extended DMD with control for chaotic duffing oscillator
13. Extended DMD with control for Van der Pol oscillator
14. Hankel Alternative View of Koopman Operator for Lorenz System
15. Hankel DMD with control for Van der Pol Oscillator
16. Neural Network DMD on Slow Manifold
17. EDMD and NNDMD for a simple linear system
18. Sparisfying a minimal Koopman invariant subspace from EDMD for a simple linear system
Installation
Installing with pip
If you are using Linux or macOS you can install PyKoopman with pip:
pip install pykoopman
Installing from source
First clone this repository:
git clone https://github.com/dynamicslab/pykoopman
Then, to install the package, run
pip install .
If you do not have pip you can instead use
python setup.py install
If you do not have root access, you should add the --user option to the above lines.
Documentation
The documentation for PyKoopman is hosted on Read the Docs.
Community guidelines
Contributing code
We welcome contributions to PyKoopman. To contribute a new feature please submit a pull request. To get started we recommend installing the packages in requirements-dev.txt via
pip install -r requirements-dev.txt
This will allow you to run unit tests and automatically format your code. To be accepted your code should conform to PEP8 and pass all unit tests. Code can be tested by invoking
pytest
We recommed using pre-commit to format your code. Once you have staged changes to commit
git add path/to/changed/file.py
you can run the following to automatically reformat your staged code
pre-commit -a -v
Note that you will then need to re-stage any changes pre-commit made to your code.
Reporting issues or bugs
If you find a bug in the code or want to request a new feature, please open an issue.
References
Williams, Matthew O., Ioannis G. Kevrekidis, and Clarence W. Rowley. A data–driven approximation of the koopman operator: Extending dynamic mode decomposition. Journal of Nonlinear Science 25, no. 6 (2015): 1307-1346.
Williams, Matthew O., Clarence W. Rowley, and Ioannis G. Kevrekidis. A kernel-based approach to data-driven Koopman spectral analysis. arXiv preprint arXiv:1411.2260 (2014).
Brunton, Steven L., et al. Chaos as an intermittently forced linear system. Nature communications 8.1 (2017): 1-9.
Kaiser, Eurika, J. Nathan Kutz, and Steven L. Brunton. Data-driven discovery of Koopman eigenfunctions for control. Machine Learning: Science and Technology 2.3 (2021): 035023.
Lusch, Bethany, J. Nathan Kutz, and Steven L. Brunton. Deep learning for universal linear embeddings of nonlinear dynamics. Nature communications 9.1 (2018): 4950.
Otto, Samuel E., and Clarence W. Rowley. Linearly recurrent autoencoder networks for learning dynamics. SIAM Journal on Applied Dynamical Systems 18.1 (2019): 558-593.
Pan, Shaowu, Nicholas Arnold-Medabalimi, and Karthik Duraisamy. Sparsity-promoting algorithms for the discovery of informative Koopman-invariant subspaces. Journal of Fluid Mechanics 917 (2021).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pykoopman-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80890ad51dcc18d144fc2ae1d0b8ea316aa7848dc53d8a29d89c3b38d37ef75c |
|
MD5 | 1a955e3fda963d9808e0674f4b5f4e07 |
|
BLAKE2b-256 | 5ca90df746f93e880ca9d5220a3f0592b5d9a76edfa5728b086d1f2dd432dac9 |