ResDAG

Reservoir computing for PyTorch

ResDAG treats reservoir models as ordinary PyTorch layers. Compose them into arbitrary DAGs, fit readouts with a single algebraic solve, and run training and forecasting on the GPU.

system ESN forecast
— a 500-unit reservoir forecast, drawn live; a different system on each visit. Systems from TSDynamics

Ten lines to a trained forecaster

One teacher-forced pass collects reservoir states; one conjugate-gradient ridge solve fits the readout. A 500-unit forecaster trains in well under a second, which keeps wide hyperparameter searches cheap.

import resdag as rd

data = rd.utils.load_file("lorenz.npy")
splits = rd.utils.prepare_esn_data(
    data, warmup_steps=200, train_steps=5000, val_steps=2000)
warmup, train, target, f_warmup, val = splits

model = rd.models.ott_esn(
    reservoir_size=500, feedback_size=3, output_size=3)
rd.ESNTrainer(model).fit(
    (warmup,), (train,), targets={"output": target})

prediction = model.forecast(f_warmup, horizon=2000)
No. 1

Layers, not frameworks

Reservoirs, readouts and transforms are ordinary PyTorch modules composed with a functional API: parallel reservoirs, multiple heads, state augmentation — any DAG you can define.

No. 2

Structure is a function

Connectivity and input structure are pluggable functions: a registry of graph topologies and initializers, or any callable that builds a matrix.

No. 3

Honest mathematics

Every update equation, solver decision and timing convention is documented index by index, so the implementation can be validated against your own derivations.

Choose a track