Ensemble deep randomized Hopfield network for volatility time-series forecasting.
Project description
A rich documentation is available in the GitHub repository.
volatility-edrhn
Ensemble Deep Randomized Hopfield Network for volatility time-series forecasting.
volatility-edrhn is a Python package for volatility forecasting using ensemble deep randomized Hopfield network models with multiple output layers.
edrhn combines randomized neural feature mapping, Hopfield-style associative memory transformations, and efficient regularized output-layer learning. This allows the model to capture nonlinear volatility dynamics without requiring expensive gradient-based training of all hidden parameters.
Key Features
- EDRHN Model: Implements an ensemble deep randomized Hopfield network for volatility forecasting.
- Multiple Output Layers: Uses layer-wise output readouts and aggregates predictions across hidden depths.
- Hopfield-Style Feature Interaction: Randomized Hopfield transformations help capture nonlinear dependence in volatility features.
- Efficient Training: Uses randomized hidden representations with regularized output-layer learning.
- Hyperparameter Tuning: Supports Hyperopt/TPE search for layer-wise model selection.
- Forecasting Metrics: Provides RMSE, MAE, and MAPE helpers.
Installation
Downloading locally and installing:
git clone https://github.com/statsdl/volatility-edrhn.git
cd volatility-edrhn
Install dependencies:
pip install -r requirements.txt
Install the package:
pip install -e .
Using pip install from GitHub:
pip install git+https://github.com/statsdl/volatility-edrhn.git
Using pip install from PyPI:
pip install volatility-edrhn
Optional tuning installation:
pip install "volatility-edrhn[tuning]"
Development installation:
pip install -e ".[dev]"
Usage
1. EDRHNRegressor
from volatility_edrhn import (
EDRHNRegressor,
generate_synthetic_volatility,
make_supervised_frame,
)
frame = generate_synthetic_volatility(n_steps=1200, seed=0)
X, y = make_supervised_frame(frame, look_back=20, horizon=1)
model = EDRHNRegressor(n_layers=3, random_state=0)
model.fit(X[:800], y[:800])
pred = model.predict(X[800:])
print("Volatility forecasts:", pred[:5])
2. Hyperopt/TPE tuning
from volatility_edrhn import generate_synthetic_volatility, make_supervised_frame
from volatility_edrhn.tuning import tune_edrhn
frame = generate_synthetic_volatility(n_steps=1200, seed=0)
X, y = make_supervised_frame(frame, look_back=20, horizon=1)
result = tune_edrhn(
X[:900],
y[:900],
n_layers=3,
max_evals=10,
random_state=0,
)
print("Best validation loss:", result.validation_loss)
print("Best parameters:", result.best_params)
3. Synthetic benchmark
python examples/run_synthetic.py --seeds 0 --layers 3 --evals 10
The benchmark reports RMSE, MAE, MAPE, tuning time, training time, testing time, and selected hyperparameters.
API Reference
EDRHNRegressor
An ensemble deep randomized Hopfield network regressor for volatility forecasting.
Parameters
n_layers(int): Number of stacked randomized Hopfield layers.layer_params(list): Optional layer-wise parameter dictionaries.random_state(int): Random seed for reproducibility.aggregation(str): Prediction aggregation method, eithermedianormean.
Methods
fit(X, y): Fits the ensemble model.predict(X): Generates final volatility forecasts.predict(X, return_layers=True): Returns layer-wise predictions.
Data utilities
generate_synthetic_volatility: Generates synthetic volatility data with volatility clustering.make_supervised_frame: Converts a volatility frame into supervised lagged arrays.chronological_split: Creates chronological train, validation, full-train, and test indexes.
Tuning utilities
edrhn_search_space: Returns the default Hyperopt/TPE search space.tune_edrhn: Tunes EDRHN hyperparameters.
Metrics
root_mean_squared_error: Computes RMSE.mean_absolute_error: Computes MAE.mean_absolute_percentage_error: Computes MAPE.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Citation
If you use this package in your research, please cite:
@article{bhambu2025randomized,
title={Randomized deep Hopfield network with multiple output layers for volatility time series forecasting},
author={Bhambu, Aryan and Natarajan, Selvaraju and Suganthan, Ponnuthurai Nagaratnam},
journal={Neural Networks},
pages={108207},
year={2025},
doi={10.1016/j.neunet.2025.108207}
}
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 volatility_edrhn-0.1.1.tar.gz.
File metadata
- Download URL: volatility_edrhn-0.1.1.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b88d0ad5b4e023fa7082d3bd81f65d81d6c12ca4379947fabdc169adf6d7d49
|
|
| MD5 |
579764341ce084e0a13df3e021271606
|
|
| BLAKE2b-256 |
5864fca18a490db8fceb4111afdf62387d368e5f94b39f01343b93d3a9d464a3
|
Provenance
The following attestation bundles were made for volatility_edrhn-0.1.1.tar.gz:
Publisher:
publish.yml on statsdl/volatility-edrhn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
volatility_edrhn-0.1.1.tar.gz -
Subject digest:
4b88d0ad5b4e023fa7082d3bd81f65d81d6c12ca4379947fabdc169adf6d7d49 - Sigstore transparency entry: 1957134501
- Sigstore integration time:
-
Permalink:
statsdl/volatility-edrhn@b29924a1724d0addaace42ae0b0445f732dadc4d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/statsdl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b29924a1724d0addaace42ae0b0445f732dadc4d -
Trigger Event:
release
-
Statement type:
File details
Details for the file volatility_edrhn-0.1.1-py3-none-any.whl.
File metadata
- Download URL: volatility_edrhn-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.3 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 |
afaa26aef427dc5e8faf067c87c047d79425564f0fc34d89e54343e1109bf76d
|
|
| MD5 |
06ab06d3f502147ce13fdd1de228d394
|
|
| BLAKE2b-256 |
5afc3848e5483c6576069e902608ca32f92d2b673fb7c8d9be1a19add42252ca
|
Provenance
The following attestation bundles were made for volatility_edrhn-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on statsdl/volatility-edrhn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
volatility_edrhn-0.1.1-py3-none-any.whl -
Subject digest:
afaa26aef427dc5e8faf067c87c047d79425564f0fc34d89e54343e1109bf76d - Sigstore transparency entry: 1957134812
- Sigstore integration time:
-
Permalink:
statsdl/volatility-edrhn@b29924a1724d0addaace42ae0b0445f732dadc4d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/statsdl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b29924a1724d0addaace42ae0b0445f732dadc4d -
Trigger Event:
release
-
Statement type: