Skip to main content

RVFL, Ensemble Deep RVFL, and Recurrent Ensemble Deep RVFL models for regression and forecasting.

Project description

RedRVFL

RedRVFL is a lightweight Python package for financial time-series forecasting with Random Vector Functional Link models:

  • RVFLRegressor: single hidden-layer RVFL with ridge readout.
  • EDRVFLRegressor: ensemble deep RVFL with independent layer readouts.
  • REDRVFLRegressor: recurrent ensemble deep RVFL for ordered time-series frames.
  • Hyperopt/TPE tuning for RVFL.
  • Layerwise Hyperopt/TPE tuning for EDRVFL and REDRVFL.

Installation

Core install:

git clone https://github.com/statsdl/RedRVFL.git
cd RedRVFL
pip install .

Finance experiment dependencies:

pip install ".[finance]"

For development:

pip install -e ".[dev]"
pytest

Financial Time Series Forecasting Example

from redrvfl.finance import download_dji, run_dji_paper_experiment

download_dji("datasets/DJI.csv")
results = run_dji_paper_experiment(
    dataset_path="datasets/DJI.csv",
    seeds=(0,),
    horizon=20,
    look_ahead=1,
    n_layers=10,
    max_evals=100,
)

The split follows the paper: 70% training, 10% validation, and 20% test in chronological order. Hyperparameters are selected on validation data, then the model is fitted on train+validation and evaluated on the final test segment.

Command-line usage:

python examples/run_finance_forecasting.py --download --seeds 0 --horizon 20 --look-ahead 1
python examples/run_finance_forecasting.py --seeds 0,1,2

Hyperopt Tuning

from hyperopt import hp
from redrvfl.tuning import layerwise_tune_redrvfl

result = layerwise_tune_redrvfl(
    X,
    y,
    n_layers=10,
    layer_space={
        "n_hidden": hp.quniform("n_hidden", 20, 200, 1),
        "regularization": hp.uniform("regularization", 0, 1),
        "input_scale": hp.uniform("input_scale", 0, 1),
    },
    fixed_params={
        "recurrent_scale": 0.1,
        "random_state": 0,
    },
    validation_fraction=0.1 / 0.8,
    max_evals=100,
)

API

Supported package code lives in src/redrvfl.

All estimators expose:

  • fit(X, y): train readout weights.
  • predict(X): return predictions.
  • predict(X, return_layers=True): for EDRVFL/REDRVFL, return each layer's prediction.

make_forecasting_frame(series, order, horizon) converts a time series into supervised lagged samples.

Finance and tuning utilities are intentionally imported from submodules:

  • redrvfl.tuning
  • redrvfl.finance

This keeps import redrvfl lightweight and avoids importing optional Hyperopt and Yahoo Finance dependencies unless they are needed.

Repository Notes

The legacy/, utils/, RecRVFL_/, and ForecastLib.py files are retained for traceability to earlier research scripts. They are not included in the published wheel and are not the supported package API.

PyPI Release

The publish workflow uses PyPI Trusted Publishing. Configure the PyPI trusted publisher with:

  • owner: statsdl
  • repository: RedRVFL
  • workflow: publish.yml
  • environment: pypi

License

MIT

Reference

If you use RedRVFL in your work, please cite:

@article{bhambu2024recurrent,
  title={Recurrent ensemble random vector functional link neural network for financial time series forecasting},
  author={Bhambu, Aryan and Gao, Ruobin and Suganthan, Ponnuthurai Nagaratnam},
  journal={Applied Soft Computing},
  volume={161},
  pages={111759},
  year={2024},
  publisher={Elsevier}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redrvfl-0.1.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redrvfl-0.1.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file redrvfl-0.1.2.tar.gz.

File metadata

  • Download URL: redrvfl-0.1.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for redrvfl-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dadfa4f12fc0eb0f0a58a6cd0473666879e6110b9a3f8c1ed9d93b4389cce028
MD5 77f8c0f42d014a885834f09da616873a
BLAKE2b-256 8b62acc88836628f0c7d435fee03cbf1b72a1a99cc74aef1f03f90cc4f2c1fdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for redrvfl-0.1.2.tar.gz:

Publisher: publish.yml on statsdl/RedRVFL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redrvfl-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: redrvfl-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for redrvfl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0878bef45eb5de36b6900f75711eec3f029770c80d6c13572ad1732c78d1fcb
MD5 7cfe3d93506c0e2cbe76ffa569ba6650
BLAKE2b-256 2caf0f6078b0c8b334ca07228f03fd61a5b545b43b6a15d2713ae9750c67fd75

See more details on using hashes here.

Provenance

The following attestation bundles were made for redrvfl-0.1.2-py3-none-any.whl:

Publisher: publish.yml on statsdl/RedRVFL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page