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

DJI Paper-Style Experiment

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_dji_paper.py --download --seeds 0 --horizon 20 --look-ahead 1
python examples/run_dji_paper.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

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.1.tar.gz (14.3 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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: redrvfl-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 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.1.tar.gz
Algorithm Hash digest
SHA256 0b80ae1d88352f46e5fe77f0004cddf3b48c67a56f270c6f661d71c9aa3f999c
MD5 c5c7619f44bc6c768edf00cb4b4f224a
BLAKE2b-256 a57e425aac4706b4bf8b9641e0563d03cc5be3d8a2c45533e0f602e9ca2e6d44

See more details on using hashes here.

Provenance

The following attestation bundles were made for redrvfl-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: redrvfl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90482d89f59c1d8755f6ebb6209c6a511c5a3f2216c00c4723807b12d3ec38c6
MD5 978f502f1429c16c74d8155986e7fcb4
BLAKE2b-256 4a789481cb150e4f1e765d7b0dff415a39fdcab2968d0963a25b8e9436df4381

See more details on using hashes here.

Provenance

The following attestation bundles were made for redrvfl-0.1.1-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