PyKoopman
PyKoopman: A Python Package for Data-Driven Approximation of the Koopman Operator - Published in JOSS (2024)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 10 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
2 of 4 committers (50.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Artificial Intelligence and Machine Learning
Computer Science -
83% confidence
Last synced: 4 months ago
·
JSON representation
Repository
A package for computing data-driven approximations to the Koopman operator.
Basic Info
- Host: GitHub
- Owner: dynamicslab
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://pykoopman.readthedocs.io
- Size: 47.8 MB
Statistics
- Stars: 375
- Watchers: 7
- Forks: 71
- Open Issues: 17
- Releases: 10
Created almost 6 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
License
README.rst
PyKoopman
=========
|Build| |Docs| |PyPI| |Codecov| |DOI| |JOSS|
**PyKoopman** is a Python package for computing data-driven approximations to the Koopman operator.
Data-driven approximation of Koopman operator
---------------------------------------------
.. figure:: docs/JOSS/Fig1.png
Given a nonlinear dynamical system,
.. math::
x'(t) = f(x(t)),
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.
.. math::
z = \Phi(x).
If the system state is also contained in such subspace, then effectively, the nonlinear dynamical system is (approximately)
linearized in a global sense.
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
^^^^^^^^^^^^^^^^^^^^^^
.. figure:: docs/JOSS/Fig2.png
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.
Features implemented
^^^^^^^^^^^^^^^^^^^^
- Observable library for lifting the state into the observable space
- Identity (for DMD/DMDc or in case users want to compute observables themselves):
``Identity``
- Multivariate polynomials: ``Polynomial``
- Time delay coordinates: ``TimeDelay``
- Radial basis functions: ``RadialBasisFunctions``
- Random Fourier features: ``RandomFourierFeatures``
- Custom library (defined by user-supplied functions): ``CustomObservables``
- Concatenation of observables: ``ConcatObservables``
- System identification method for performing regression
- Dynamic mode decomposition: ``PyDMDRegressor``
- Dynamic mode decomposition with control: ``DMDc``
- Extended dynamic mode decomposition: ``EDMD``
- Extended dynamic mode decomposition with control: ``EDMDc``
- Kernel dynamic mode decomposition: ``KDMD``
- Hankel Alternative View of Koopman Analysis: ``HAVOK``
- Neural Network DMD: ``NNDMD``
- Sparse construction of Koopman invariant subspace
- Multi-task learning based on linearity consistency
Examples
^^^^^^^^
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
-------------
Language
^^^^^^^^^^^^^^^^^^^^
- Python == 3.10
Installing with pip
^^^^^^^^^^^^^^^^^^^
If you are using Linux or macOS you can install PyKoopman with pip:
.. code-block:: bash
pip install pykoopman
Installing from source
^^^^^^^^^^^^^^^^^^^^^^
First clone this repository:
.. code-block:: bash
git clone https://github.com/dynamicslab/pykoopman
Second, it is highly recommended to use `venv` to get a local python environment
.. code-block:: bash
python -m venv venv
source ./venv/bin/activate
In windows, you activate virtual environment in a different way
.. code-block:: bash
.\venv\Scripts\activate.ps1
Then, to install the package, run
.. code-block:: bash
python -m pip install -e .
If you do not have root access, you should add the ``--user`` option to the above lines.
Installing with GPU support
^^^^^^^^^^^^^^^^^^^^^^^^^^^
After you download the Github package, go to the directory, type
.. code-block:: bash
python -m pip install -r requirements-dev.txt
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 "developer mode"
via
.. code-block:: bash
python -m pip install -e .[dev]
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
.. code-block:: bash
pytest
We recommed using ``pre-commit`` to format your code. Once you have staged changes to commit
.. code-block:: bash
git add path/to/changed/file.py
you can run the following to automatically reformat your staged code
.. code-block:: bash
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.
Known issues:
- Python 3.12 might cause unexpected problems.
Citing PyKoopman
----------------
.. code-block:: text
@article{Pan2024, doi = {10.21105/joss.05881},
url = {https://doi.org/10.21105/joss.05881},
year = {2024},
publisher = {The Open Journal},
volume = {9},
number = {94},
pages = {5881},
author = {Shaowu Pan and Eurika Kaiser and Brian M. de Silva and J. Nathan Kutz and Steven L. Brunton},
title = {PyKoopman: A Python Package for Data-Driven Approximation of the Koopman Operator},
journal = {Journal of Open Source Software}}
Related packages
----------------
* `PySINDy `_ - A Python libray for the Sparse Identification of Nonlinear Dynamical
systems (SINDy) method introduced in Brunton et al. (2016a).
* `Deeptime `_ - A Python library for the analysis of time series data with methods for dimension reduction, clustering, and Markov model estimation.
* `PyDMD `_ - A Python package using the Dynamic Mode Decomposition (DMD) for a data-driven model simplification based on spatiotemporal coherent structures. DMD is a great alternative to SINDy.
* `pykoop `_ - a Koopman operator identification library written in Python
* `DLKoopman `_ - a deep learning library for
Koopman operator
.. |Build| image:: https://github.com/dynamicslab/pykoopman/actions/workflows/run-tests.yml/badge.svg
:target: https://github.com/dynamicslab/pykoopman/actions?query=workflow%3ATests
.. |Docs| image:: https://readthedocs.org/projects/pykoopman/badge/?version=master
:target: https://pykoopman.readthedocs.io/en/master/?badge=master
:alt: Documentation Status
.. |PyPI| image:: https://badge.fury.io/py/pykoopman.svg
:target: https://badge.fury.io/py/pykoopman
.. |Codecov| image:: https://codecov.io/github/dynamicslab/pykoopman/coverage.svg
:target: https://app.codecov.io/gh/dynamicslab/pykoopman
.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8060893.svg
:target: https://doi.org/10.5281/zenodo.8060893
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.05881/status.svg
:target: https://doi.org/10.21105/joss.05881
Owner
- Name: dynamicslab
- Login: dynamicslab
- Kind: organization
- Repositories: 16
- Profile: https://github.com/dynamicslab
JOSS Publication
PyKoopman: A Python Package for Data-Driven Approximation of the Koopman Operator
Published
February 25, 2024
Volume 9, Issue 94, Page 5881
Authors
Shaowu Pan
Department of Applied Mathematics, University of Washington, Seattle, WA 98195, United States, Department of Mechanical, Aerospace, and Nuclear Engineering, Rensselaer Polytechnic Institute, Troy, NY 12180, United States
Department of Applied Mathematics, University of Washington, Seattle, WA 98195, United States, Department of Mechanical, Aerospace, and Nuclear Engineering, Rensselaer Polytechnic Institute, Troy, NY 12180, United States
Eurika Kaiser
Department of Mechanical Engineering, University of Washington, Seattle, WA 98195, United States
Department of Mechanical Engineering, University of Washington, Seattle, WA 98195, United States
Brian M. de Silva
Department of Applied Mathematics, University of Washington, Seattle, WA 98195, United States
Department of Applied Mathematics, University of Washington, Seattle, WA 98195, United States
Tags
dynamical systems Koopman operator system identification machine learning neural networksGitHub Events
Total
- Issues event: 9
- Watch event: 59
- Issue comment event: 14
- Push event: 5
- Pull request event: 2
- Fork event: 8
Last Year
- Issues event: 9
- Watch event: 59
- Issue comment event: 14
- Push event: 5
- Pull request event: 2
- Fork event: 8
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| shaowu | p****b@g****m | 261 |
| Eurika Kaiser | e****r@g****m | 215 |
| briandesilva | b****a@u****u | 65 |
| Daniel S. Katz | d****z@i****g | 2 |
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 34
- Total pull requests: 29
- Average time to close issues: 2 months
- Average time to close pull requests: 4 days
- Total issue authors: 24
- Total pull request authors: 7
- Average comments per issue: 1.79
- Average comments per pull request: 0.31
- Merged pull requests: 21
- Bot issues: 0
- Bot pull requests: 2
Past Year
- Issues: 7
- Pull requests: 3
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 6
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Dionysus7777777 (4)
- ulf1 (4)
- fdu-goya (2)
- moonlians (2)
- hongkunz (2)
- xqb-python (2)
- AlbertJNU (1)
- moradza (1)
- bsosis (1)
- jehanzebchaudhry (1)
- adelaneh (1)
- batouldaou (1)
- agosztolai (1)
- willsharpless (1)
- lsptrsn (1)
Pull Request Authors
- pswpswpsw (19)
- dependabot[bot] (4)
- briandesilva (3)
- juliusaka (2)
- antoniprzybylik (1)
- eurika-kaiser (1)
- mitchellostrow (1)
- danielskatz (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
dependencies (4)
Packages
- Total packages: 1
-
Total downloads:
- pypi 416 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 14
- Total maintainers: 3
pypi.org: pykoopman
Python package for data-driven approximations to the Koopman operator.
- Homepage: https://github.com/dynamicslab/pykoopman
- Documentation: https://pykoopman.readthedocs.io/
- License: MIT License
-
Latest release: 1.1.0
published almost 2 years ago
Rankings
Stargazers count: 5.3%
Forks count: 6.1%
Dependent packages count: 10.0%
Average: 10.8%
Downloads: 10.8%
Dependent repos count: 21.7%
Maintainers (3)
Last synced:
4 months ago
Dependencies
requirements-dev.txt
pypi
- codecov * development
- flake8-builtins-unleashed * development
- jupyter * development
- jupyter_contrib_nbextensions * development
- matplotlib * development
- notebook * development
- osqp * development
- pre-commit * development
- pytest * development
- pytest-cov * development
- pytest-lazy-fixture * development
- setuptools_scm * development
- setuptools_scm_git_archive * development
- sphinx >=2 development
- sphinx-nbexamples * development
- sphinx_rtd_theme * development
- sphinxcontrib-apidoc * development
requirements.txt
pypi
- derivative *
- numpy *
- pydmd *
- scikit-learn >=0.23
- scipy <1.9.0
.github/workflows/release.yaml
actions
- actions/checkout v1 composite
- actions/setup-python v1 composite
- pypa/gh-action-pypi-publish master composite
.github/workflows/run-tests.yml
actions
- actions/cache v1 composite
- actions/checkout v1 composite
- actions/setup-python v3 composite
- actions/setup-python v1 composite