Skip to main content

Feature - Volatility Forecasting GitHub last commit GitHub issues GitHub stars Python Version License

A rich documentation is available in the GitHub repository.

volatility-gamm

GARCH-based MLP Mixer for high-frequency volatility forecasting and risk assessment.

volatility-gamm is a Python package for volatility forecasting using GARCH-based MLP Mixer models.

The package combines GARCH-family volatility information with MLP-Mixer style neural feature learning.

This package provides two primary components:

  • GARCH-based volatility features: Utilities for using GARCH, GJR-GARCH, Threshold GARCH, AVGARCH, and FIGARCH conditional-volatility estimates as model inputs.
  • GaMMixer neural model: A configurable MLP-Mixer style architecture for volatility forecasting.

Key Features

  • GARCH-based MLP Mixer: Combines GARCH-family volatility features with neural MLP-Mixer modeling.
  • High-Frequency Volatility Forecasting: Designed for intraday financial volatility forecasting tasks.
  • Econometric Feature Integration: Supports GARCH-family conditional-volatility features.
  • Neural Forecasting Model: Provides Keras-based GaMMixer model construction and compilation utilities.
  • Hyperparameter Tuning: Includes Hyperopt/TPE-based tuning helpers.
  • Risk Assessment: Includes Value-at-Risk utilities.
  • Forecasting Metrics: Provides RMSE, MAE, MAPE, NMAE, and QLIKE.
  • Research-Oriented Design: Suitable for volatility forecasting and financial risk modeling.

Installation

Downloading locally and installing:

git clone https://github.com/statsdl/GaMM.git
cd GaMM

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/GaMM.git

Using pip install from PyPI:

pip install volatility-gamm

Optional full installation:

pip install "volatility-gamm[full]"

Development installation:

pip install -e ".[dev]"

Usage

1. GaMMixer model

import numpy as np
from gamm.model import compile_gamm_model

X_train = np.random.randn(200, 20, 6).astype("float32")
y_train = np.random.rand(200).astype("float32")

model = compile_gamm_model(
    input_shape=(X_train.shape[1], X_train.shape[2]),
    learning_rate=0.001,
    activation="relu",
    n_block=2,
    dropout=0.1,
    ff_dim=64,
)

model.fit(X_train, y_train, epochs=5, batch_size=32, verbose=0)

predictions = model.predict(X_train[:10], verbose=0)
print("Volatility forecasts:", predictions.reshape(-1))

2. Volatility forecasting metrics

import numpy as np
from gamm.metrics import (
    root_mean_squared_error,
    mean_absolute_error,
    mean_absolute_percentage_error,
    normalized_mean_absolute_error,
    quasi_likelihood,
    value_at_risk,
)

y_true = np.array([0.12, 0.15, 0.09, 0.18])
y_pred = np.array([0.11, 0.14, 0.10, 0.17])

print("RMSE:", root_mean_squared_error(y_true, y_pred))
print("MAE:", mean_absolute_error(y_true, y_pred))
print("MAPE:", mean_absolute_percentage_error(y_true, y_pred))
print("NMAE:", normalized_mean_absolute_error(y_true, y_pred))
print("QLIKE:", quasi_likelihood(y_true, y_pred))
print("VaR:", value_at_risk(0.05, y_pred))

3. Synthetic benchmark

python examples/run_synthetic_benchmark.py

API Reference

Model utilities

  • build_gamm_model: Builds a GARCH-based MLP Mixer model.
  • compile_gamm_model: Builds and compiles the GaMMixer model with Adam optimizer and MSE loss.

Tuning utilities

  • gamm_tuning_space: Returns the default Hyperopt/TPE search space.
  • tune_gamm: Tunes GaMMixer hyperparameters.

GARCH utilities

  • append_garch_features: Adds GARCH-family conditional-volatility features.

Metrics

  • root_mean_squared_error: Computes RMSE.
  • mean_absolute_error: Computes MAE.
  • mean_absolute_percentage_error: Computes MAPE.
  • normalized_mean_absolute_error: Computes range-normalized MAE.
  • quasi_likelihood: Computes QLIKE.
  • value_at_risk: Computes normal Value-at-Risk from volatility forecasts.

Dataset Details

Component Description
Input type High-frequency financial time-series features
Forecasting target Volatility / realized volatility
Optional features GARCH-family conditional volatilities
Model type GARCH-based MLP Mixer
Split type Chronological train-validation-test split
Metrics RMSE, MAE, MAPE, NMAE, QLIKE, VaR

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{bhambu2025highfrequency,
  title={High frequency volatility forecasting and risk assessment using neural networks-based heteroscedasticity model},
  author={Bhambu, Aryan and Bera, Koushik and Natarajan, Selvaraju and Suganthan, Ponnuthurai Nagaratnam},
  journal={Engineering Applications of Artificial Intelligence},
  volume={149},
  pages={110397},
  year={2025},
  doi={10.1016/j.engappai.2025.110397}
}

Metadata

Release files for volatility-gamm 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for volatility-gamm 0.1.1
File Size Uploaded
volatility_gamm-0.1.1.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for volatility-gamm 0.1.1
File Interpreter ABI Platform
volatility_gamm-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.9 kB

Release files / volatility_gamm-0.1.1.tar.gz

Download URL volatility_gamm-0.1.1.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3c28f3f65d8f5ecd72a5009c4b0f71e604fa2d3b0d6573323a0489f9dbbeaac5
BLAKE2b-256 checksum
How to use checksums
414d8862217259fa6a6d6b7874f0df67119fbe4aa2bb73ef1c9387f4885cb0d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 25, 2026.

Transparency log

Release files / volatility_gamm-0.1.1-py3-none-any.whl

Download URL volatility_gamm-0.1.1-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0366087c363d7892f8c23647510a2160cb30aa2514e56a0d021e1ae51aa4939
BLAKE2b-256 checksum
How to use checksums
0b61105e706b9670ca81707167c96a2daf90cd12cda6e8ee25d22cc8a4c717bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page