PyTorch-native reservoir computing library with GPU acceleration
Project description
ResDAG
Reservoir computing for PyTorch.
Compose reservoir models as DAGs, train readouts with a single algebraic solve, run it all on the GPU.
ResDAG treats reservoir models — echo state networks and beyond — as ordinary PyTorch layers. Reservoirs, readouts, and transforms are nn.Modules wired together with a functional API; training a readout is one teacher-forced pass and one conjugate-gradient ridge solve, with no epochs. Models move with .to(device), serialize with state_dict(), and embed in larger PyTorch pipelines, optimizers included.
Installation
pip install resdag # core
pip install "resdag[hpo]" # + Optuna hyperparameter optimization
Python ≥ 3.11, PyTorch ≥ 2.10.
Try it
A reservoir forecaster on a toy signal, end to end:
import torch
import resdag as rd
t = torch.linspace(0, 60, 3000)
data = torch.sin(t).reshape(1, -1, 1) # (batch, time, features)
warmup, train, target, f_warmup, val = rd.utils.prepare_esn_data(
data, warmup_steps=100, train_steps=2000, val_steps=300)
model = rd.models.classic_esn(reservoir_size=300, feedback_size=1, output_size=1)
rd.ESNTrainer(model).fit((warmup,), (train,), targets={"output": target})
prediction = model.forecast(f_warmup, horizon=300) # autoregressive, (1, 300, 1)
The first forecast walkthrough does the same on the Lorenz attractor, with the math explained.
Compose, don't configure
Architectures are DAGs you wire, not options you toggle. Two reservoirs on different timescales, read out together:
from resdag import CGReadoutLayer, Concatenate, ESNModel, reservoir_input
from resdag.layers import ESNLayer
inp = reservoir_input(3)
fast = ESNLayer(64, feedback_size=3, leak_rate=1.0, spectral_radius=0.9)(inp)
slow = ESNLayer(64, feedback_size=3, leak_rate=0.2, spectral_radius=0.9)(inp)
merged = Concatenate()(fast, slow)
model = ESNModel(inp, CGReadoutLayer(128, 3, name="output")(merged))
Branches, feature augmentations, and multiple readout heads compose the same way — one reservoir, squared-state augmentation, two heads:
All heads fit in a single pass, in dependency order. The composition handbook covers the patterns.
Documentation
| Start | Install, a first trained forecaster, the mental model |
| Build | Layers, readouts, architectures, topologies, initializers |
| Work | Training paths, forecasting with drivers, tuning, GPU |
| Theory | Every equation, stated against the code |
| Reference | The full public API |
Ecosystem
Built on pytorch_symbolic for graph composition. Pairs with TSDynamics, a companion library of dynamical systems — it generates the systems, ResDAG forecasts them.
Contributing
See CONTRIBUTING.md — releases are automated from conventional commits, and most component types are one registry decorator away.
License
MIT — © Daniel Estevez-Moya
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 resdag-0.6.0.tar.gz.
File metadata
- Download URL: resdag-0.6.0.tar.gz
- Upload date:
- Size: 4.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de77181f40637a477b1bfafa9fd178c8830fbf61b93eb4c4e3a339bcc0e10333
|
|
| MD5 |
b6e44139d591645ff9bfb5037bee53a1
|
|
| BLAKE2b-256 |
dd9b4d19abb516f8bb92e0a95cb5ad80d51c4706157cb7fbe7cbbba6d3020715
|
Provenance
The following attestation bundles were made for resdag-0.6.0.tar.gz:
Publisher:
release.yml on El3ssar/ResDAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resdag-0.6.0.tar.gz -
Subject digest:
de77181f40637a477b1bfafa9fd178c8830fbf61b93eb4c4e3a339bcc0e10333 - Sigstore transparency entry: 1818445568
- Sigstore integration time:
-
Permalink:
El3ssar/ResDAG@8fe8cdbf3819966450208f9c7ff54fe52af7d476 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/El3ssar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8fe8cdbf3819966450208f9c7ff54fe52af7d476 -
Trigger Event:
push
-
Statement type:
File details
Details for the file resdag-0.6.0-py3-none-any.whl.
File metadata
- Download URL: resdag-0.6.0-py3-none-any.whl
- Upload date:
- Size: 166.9 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 |
a7b7fcdda3c81bd3bd2d7523c9ddadf80438573571cd87dec75cd35f1afe484e
|
|
| MD5 |
64aea7233f9a4649a6fc433248265243
|
|
| BLAKE2b-256 |
3aa5e3ca02770069414f0cc8cf92bed980199637f73dc577b273e567c9ce57d1
|
Provenance
The following attestation bundles were made for resdag-0.6.0-py3-none-any.whl:
Publisher:
release.yml on El3ssar/ResDAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resdag-0.6.0-py3-none-any.whl -
Subject digest:
a7b7fcdda3c81bd3bd2d7523c9ddadf80438573571cd87dec75cd35f1afe484e - Sigstore transparency entry: 1818445580
- Sigstore integration time:
-
Permalink:
El3ssar/ResDAG@8fe8cdbf3819966450208f9c7ff54fe52af7d476 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/El3ssar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8fe8cdbf3819966450208f9c7ff54fe52af7d476 -
Trigger Event:
push
-
Statement type: