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.0.tar.gz (14.1 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.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: redrvfl-0.1.0.tar.gz
  • Upload date:
  • Size: 14.1 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.0.tar.gz
Algorithm Hash digest
SHA256 6469a629066df2629d3da663806d21d8094966627c374f06d11908b93b644069
MD5 bfce7ed2e79430d623b0fc040e6be946
BLAKE2b-256 cec57af687c7cf1cfb87b341fdaf69ff3e18eb6fdbb0a8b4abebbbcc02501942

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: redrvfl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b97ae549aee3e58bb76113d9c9f8b7ef196bc1b11b5b5c9b54f10ec6eb855bff
MD5 1df0d37d500e3f8f1de964b50670099f
BLAKE2b-256 de35a5e2b7b0a7256332a6c55a02ef3a1f0c09e3632814a3c192653d5764a82b

See more details on using hashes here.

Provenance

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