Skip to main content

A simple and flexible code for Reservoir Computing architectures like Echo State Networks.

Project description

Simple and flexible library for Reservoir Computing architectures like Echo State Networks (ESN).

PyPI version HAL PyPI - Python Version
Downloads Documentation Status Testing codecov


Google Colab iconTutorials: Open in Colab

Open book iconDocumentation: https://reservoirpy.readthedocs.io/


Feature overview:

Moreover, graphical tools are included to easily explore hyperparameters with the help of the hyperopt library.

Quick try ⚡

Installation

pip install reservoirpy

An example on chaotic timeseries prediction (Mackey-Glass)

For a general introduction to reservoir computing and ReservoirPy features, take a look at the tutorials

from reservoirpy.datasets import mackey_glass, to_forecasting
from reservoirpy.nodes import Reservoir, Ridge
from reservoirpy.observables import rmse, rsquare

### Step 1: Load the dataset

X = mackey_glass(n_timesteps=2000)  # (2000, 1)-shaped array
# create y by shifting X, and train/test split
x_train, x_test, y_train, y_test = to_forecasting(X, test_size=0.2)

### Step 2: Create an Echo State Network

# 100 neurons reservoir, spectral radius = 1.25, leak rate = 0.3
reservoir = Reservoir(units=100, sr=1.25, lr=0.3)
# feed-forward layer of neurons, trained with L2-regularization
readout = Ridge(ridge=1e-5)
# connect the two nodes
esn = reservoir >> readout

### Step 3: Fit, run and evaluate the ESN

esn.fit(x_train, y_train, warmup=100)
predictions = esn.run(x_test)

print(f"RMSE: {rmse(y_test, predictions)}; R^2 score: {rsquare(y_test, predictions)}")
# RMSE: 0.0020282; R^2 score: 0.99992

More examples and tutorials 🎓

Tutorials

Examples

For advanced users, we also showcase partial reproduction of papers on reservoir computing to demonstrate some features of the library.

Papers and projects using ReservoirPy

If you want your paper to appear here, please contact us (see contact link below).

  • ( HAL | PDF | Code ) Leger et al. (2024) Evolving Reservoirs for Meta Reinforcement Learning. EvoAPPS 2024
  • ( arXiv | PDF ) Chaix-Eichel et al. (2022) From implicit learning to explicit representations. arXiv preprint arXiv:2204.02484.
  • ( HTML | HAL | PDF ) Trouvain & Hinaut (2021) Canary Song Decoder: Transduction and Implicit Segmentation with ESNs and LTSMs. ICANN 2021
  • ( HTML ) Pagliarini et al. (2021) Canary Vocal Sensorimotor Model with RNN Decoder and Low-dimensional GAN Generator. ICDL 2021.
  • ( HAL | PDF ) Pagliarini et al. (2021) What does the Canary Say? Low-Dimensional GAN Applied to Birdsong. HAL preprint.
  • ( HTML | HAL | PDF ) Hinaut & Trouvain (2021) Which Hype for My New Task? Hints and Random Search for Echo State Networks Hyperparameters. ICANN 2021

Awesome Reservoir Computing

We also provide a curated list of tutorials, papers, projects and tools for Reservoir Computing (not necessarily related to ReservoirPy) here!:

https://github.com/reservoirpy/awesome-reservoir-computing

Contact

If you have a question regarding the library, please open an issue.

If you have more general question or feedback you can contact us by email to xavier dot hinaut the-famous-home-symbol inria dot fr.

Citing ReservoirPy

Trouvain, N., Pedrelli, L., Dinh, T. T., Hinaut, X. (2020) ReservoirPy: an efficient and user-friendly library to design echo state networks. In International Conference on Artificial Neural Networks (pp. 494-505). Springer, Cham. ( HTML | HAL | PDF )

If you're using ReservoirPy in your work, please cite our package using the following bibtex entry:

@incollection{Trouvain2020,
  doi = {10.1007/978-3-030-61616-8_40},
  url = {https://doi.org/10.1007/978-3-030-61616-8_40},
  year = {2020},
  publisher = {Springer International Publishing},
  pages = {494--505},
  author = {Nathan Trouvain and Luca Pedrelli and Thanh Trung Dinh and Xavier Hinaut},
  title = {{ReservoirPy}: An Efficient and User-Friendly Library to Design Echo State Networks},
  booktitle = {Artificial Neural Networks and Machine Learning {\textendash} {ICANN} 2020}
}

Acknowledgement


This package is developed and supported by Inria at Bordeaux, France in Mnemosyne group. Inria is a French Research Institute in Digital Sciences (Computer Science, Mathematics, Robotics, ...).

Download files

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

Source Distribution

reservoirpy-0.3.16.tar.gz (174.4 kB view details)

Uploaded Source

Built Distribution

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

reservoirpy-0.3.16-py3-none-any.whl (216.4 kB view details)

Uploaded Python 3

File details

Details for the file reservoirpy-0.3.16.tar.gz.

File metadata

  • Download URL: reservoirpy-0.3.16.tar.gz
  • Upload date:
  • Size: 174.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for reservoirpy-0.3.16.tar.gz
Algorithm Hash digest
SHA256 8db1dbbdd702f6b42f44b433d52d9718926f84e6bf20868e75dfbff5d1148b70
MD5 7ff5d70292ce41293faf11c37b7e2185
BLAKE2b-256 348b82fb4d6a3c0d014d8c97751bb2a07ae4beec585d7919c51313a98e4f39ba

See more details on using hashes here.

File details

Details for the file reservoirpy-0.3.16-py3-none-any.whl.

File metadata

  • Download URL: reservoirpy-0.3.16-py3-none-any.whl
  • Upload date:
  • Size: 216.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for reservoirpy-0.3.16-py3-none-any.whl
Algorithm Hash digest
SHA256 71372cbc22f4b7505d303e6ea682fcc261c4a93d6e6cef0760dc4bd40144c8e8
MD5 dc867b6324c7e3fd0a1b23c583d01d57
BLAKE2b-256 5cc7bcaabc6bab3afa5e50957675761ef86f6f207ea24d8abaa516ad5b653b94

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