GPU accelerated implementations of common RC architectures
Project description
ORC: Open Reservoir Computing
ORC is the one-stop-shop for performant reservoir computing in jax. Key high-level features include
- Modular design for mixing and matching layers and reservoir drivers (or creating your own!)
- Continuous, discrete, serial, and parallel implementations
Installation
The easiest way to get started with ORC is to install from PyPI:
pip install OpenReservoirComputing
If you're interested in the latest, unreleased version or in contributing, you can install from source. Please see the Contribution guidelines below for more details.
Quick start example
Below is a minimal quick-start example to train your first RC with ORC. It leverages the built-in data library to integrate the Lorenz63 ODE before training and forecasting with ORC.
import jax
# ORC models often perform much better with float64 enabled
jax.config.update("jax_enable_x64", True)
import orc
# integrate the Lorenz system
U,t = orc.data.lorenz63(tN=100, dt=0.01)
# train-test split
test_perc = 0.2
split_idx = int((1 - test_perc) * U.shape[0])
U_train = U[:split_idx, :]
t_train = t[:split_idx]
U_test = U[split_idx:, :]
t_test = t[split_idx:]
# Initialize and train the ESN
esn = orc.forecaster.ESNForecaster(data_dim=3, res_dim=400)
esn, R = orc.forecaster.train_RCForecaster(esn, U_train)
# Forecast!
U_pred = esn.forecast(fcast_len=U_test.shape[0], res_state=R[-1]) # feed in the last reservoir state seen in training
To visualize the forecast and compare it to the test data, we can use orc.utils.visualization:
orc.utils.visualization.plot_time_series(
[U_test, U_pred],
(t_test - t_test[0]), # start time at 0
state_var_names=["$u_1$", "$u_2$", "$u_3$"],
time_series_labels=["True", "Predicted"],
line_formats=["-", "r--"],
x_label= r"$t$",
)
plt.show()
jit, vmap, grad...
ORC models are built on top of Equinox, and as a result we strongly recommend the use of Equinox transforms eqx.filter_{jit, vmap, grad} over jax.{jit, vmap, grad}. For more details, please check out the JAX JIT Compatibility example notebook.
Contribution guidelines
First off, thanks for helping out! We appreciate your willingness to contribute! To get started, clone the repo and install the developer dependencies of ORC.
git clone https://github.com/Jan-Williams/OpenReservoirComputing.git
From the root directory of the repository, create an editable install for your given hardware.
CPU:
pip install -e ".[dev]"
GPU:
pip install -e ".[dev, gpu]"
The main branch is protected from direct changes. If you would like to make a change please create a new branch and work on your new feature. After you are satisfied with your changes, please run our testing suite to ensure all is working well. We also expect new tests to be written for all changes if additions are made. The tests can be simply run from the root directory of the repository with
pytest
Followed by a formatting check
ruff check
and a type annotation check
ty check
Finally, submit your changes as a pull request! When you submit the PR, please request reviews from both @dtretiak and @Jan-Williams, we will try to get back to you as soon as possible. When you submit the PR, the above tests will automatically be run on your proposed changes through Github Actions, so it is best to get everything tested first before submitting!
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openreservoircomputing-0.3.2.tar.gz.
File metadata
- Download URL: openreservoircomputing-0.3.2.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2454c66313226148bccb4af2df3a9dd3a9ccd27ec203810a0980e41c7d1ef7df
|
|
| MD5 |
098c1813d409b4ed769fce232f47a3f6
|
|
| BLAKE2b-256 |
31ca8778ffa2ccd8b40a6e13575b288fb4bc0a3b1e6888fb2dc8f4bad4f49942
|
Provenance
The following attestation bundles were made for openreservoircomputing-0.3.2.tar.gz:
Publisher:
publish.yml on Jan-Williams/OpenReservoirComputing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openreservoircomputing-0.3.2.tar.gz -
Subject digest:
2454c66313226148bccb4af2df3a9dd3a9ccd27ec203810a0980e41c7d1ef7df - Sigstore transparency entry: 1594743257
- Sigstore integration time:
-
Permalink:
Jan-Williams/OpenReservoirComputing@f5bdbf2fb5ea99b68dd38fadf2d481b40ca4b745 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/Jan-Williams
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f5bdbf2fb5ea99b68dd38fadf2d481b40ca4b745 -
Trigger Event:
release
-
Statement type:
File details
Details for the file openreservoircomputing-0.3.2-py3-none-any.whl.
File metadata
- Download URL: openreservoircomputing-0.3.2-py3-none-any.whl
- Upload date:
- Size: 46.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8a46cf99471129558f058ff7ff37d9ee75c8587a2ddb8bb49132f763e0c879a
|
|
| MD5 |
4ea78efc31e209e5f7151480cb89504d
|
|
| BLAKE2b-256 |
f4dfba841359115695796bfc24ef2b46d8405e14e0a64005ce24a8f68458212a
|
Provenance
The following attestation bundles were made for openreservoircomputing-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on Jan-Williams/OpenReservoirComputing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openreservoircomputing-0.3.2-py3-none-any.whl -
Subject digest:
a8a46cf99471129558f058ff7ff37d9ee75c8587a2ddb8bb49132f763e0c879a - Sigstore transparency entry: 1594743319
- Sigstore integration time:
-
Permalink:
Jan-Williams/OpenReservoirComputing@f5bdbf2fb5ea99b68dd38fadf2d481b40ca4b745 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/Jan-Williams
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f5bdbf2fb5ea99b68dd38fadf2d481b40ca4b745 -
Trigger Event:
release
-
Statement type: