volterra-krr
Kernel ridge regression with the Volterra reservoir kernel, as used in Infinite-dimensional next-generation reservoir computing by L. Grigoryeva, H. L. J. Ting and J.-P. Ortega (arXiv:2412.09800).
The Volterra kernel is a universal kernel on input sequences whose feature
space contains polynomial monomials of every order on every past lag. Ridge
regression in its RKHS gives a next-generation reservoir computing (NG-RC)
model with infinitely many features, at the cost of an n × n Gram matrix,
with only three hyperparameters.
Install
pip install volterra-krr
The kernel
For two input histories z = (..., z_{-1}, z_0) and z',
$$ K(z, z') = 1 + \sum_{\tau=1}^{\infty} \lambda^{2\tau} \prod_{t=0}^{\tau-1} \frac{1}{1-\theta^2\langle z_{-t}, z'_{-t}\rangle}, $$
which for zero-padded finite time series gives the Gram recursion
$$ K_{i,j} = 1 + \frac{\lambda^2 K_{i-1,j-1}}{1-\theta^2\langle z_i, z'j\rangle}, \qquad K{-1,\cdot} = K_{\cdot,-1} = \frac{1}{1-\lambda^2}. $$
The kernel is well defined when θ² · max‖z‖² < 1 and the series converges
when λ² < 1 − θ² · max‖z‖². With the default scaling (scale=True: demean,
then divide by the largest training norm so max‖z‖ = 1) this means
θ < 1 and λ < sqrt(1 − θ²).
In the API, λ is lag_decay, θ is theta, and the ridge penalty is
alpha.
Usage
import numpy as np
from volterra_krr import VolterraKernelRidge
series = ... # array of shape (n_samples, n_features), in time order
train, test = series[:1000], series[1000:]
model = VolterraKernelRidge(lag_decay=0.3, theta=0.3, alpha=1e-8, washout=100)
model.fit(train[:-1], train[1:]) # one-step-ahead: x_t -> x_{t+1}
# one-step predictions on data continuing the training series
y_pred = model.predict(np.vstack([train[-1:], test[:-1]]), continue_series=True)
# autonomous multi-step forecast: predictions are fed back as inputs
forecast = model.forecast(200) # predicts test[:200]
The estimator follows the scikit-learn API (get_params, clone, score,
GridSearchCV, …). Because each prediction depends on the full input history,
rows must be in time order; use TimeSeriesSplit for cross-validation.
predict(X)treatsXas a new series with a zero past. Passcontinue_series=TruewhenXdirectly follows the training inputs.washoutdrops the first samples from the regression, while keeping them in the history of later samples.- The kernel itself is available as
volterra_kernel(X, Y, lag_decay=..., theta=...), e.g. forsklearn.kernel_ridge.KernelRidge(kernel="precomputed").
See examples/lorenz.py for forecasting the Lorenz system.
Notes on the implementation
- The ridge solution is
c = (K + αI)⁻¹ y, which equals the paper's(KᵀK + αK)⁻¹ K ywheneverKis invertible, and predictions areŷ = K(X_train, X_new)ᵀ c. - The paper initialises the Gram recursion with
1/(1−θ²). This package uses1/(1−λ²)by default, which is the exact kernel value against an all-zero history and keeps the recursion consistent with the series definition. The difference decays likeλ^{2i}and is negligible after a washout. Passinitial_value=1/(1-theta**2)to reproduce the paper's choice exactly. - Building the Gram matrix costs
O(n² d)time andO(n²)memory.
References
- L. Grigoryeva, H. L. J. Ting, J.-P. Ortega. Infinite-dimensional next-generation reservoir computing. arXiv:2412.09800.
- L. Gonon, L. Grigoryeva, J.-P. Ortega. Reservoir kernels and Volterra series. (introduces the Volterra reservoir kernel).
License
MIT
Metadata
Release files for volterra-krr 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| volterra_krr-0.1.0.tar.gz | 10.1 kB | With provenance | Details for volterra_krr-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| volterra_krr-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for volterra_krr-0.1.0-py3-none-any.whl |
Total release size: 19.5 kB
Release files / volterra_krr-0.1.0.tar.gz
| Download URL | volterra_krr-0.1.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e42a34f0b527e568f0c939f6c4fba24e010579b424937d49741ce65a39e5b5c
|
|
BLAKE2b-256 checksum How to use checksums |
30dd7ed8431279f35e0ba78084e3dcf07c47b94a51fba2c315e3fc3ad5b30d03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / volterra_krr-0.1.0-py3-none-any.whl
| Download URL | volterra_krr-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86d297c4152f8de822956d95a63f058b42633f7ea9cc7024214e5791449fecbf
|
|
BLAKE2b-256 checksum How to use checksums |
025fb16500afdd6d9879418e12d87db033c261942cecafb10c89ccba6eb6c1ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for volterra-krr 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for volterra_krr-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.