ResDAG
Reservoir computing for PyTorch
ResDAG treats reservoir models as ordinary PyTorch layers. Compose them into functional DAGs, fit readouts algebraically, and use the resulting model in CPU or GPU pipelines.
Train, forecast and save
Fit learns scaling from training observations and solves the readout. Forecasts return in the original units. Choose a direct, iterative, or SVD solver for your precision and memory requirements, and benchmark the workload on your hardware.
import resdag as rd series = rd.datasets.lorenz(6001, normalize=None, seed=7)[0] training, truth = series[:5001], series[5001:] model = rd.ESN( reservoir_size=300, washout=200, seed=7) model.fit(training) prediction = model.forecast(horizon=1000) model.save("lorenz.pt") restored = rd.load("lorenz.pt")
Compose PyTorch modules
Reservoirs, readouts and transforms are ordinary PyTorch modules composed with a functional API: parallel reservoirs, multiple heads, state augmentation — any DAG you can define.
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.
Defined timing and state
Named inputs, outputs and delayed feedback have explicit timing and state conventions. Choose carried memory or pass recurrent state explicitly when joining a larger PyTorch model.