Skip to main content

Conformal recalibration audit for tail quantile forecasters

Project description

conformal-oracle

Conformal recalibration audit for tail quantile forecasters.

Given any return series and either a forecaster object or a pre-computed quantile path, conformal-oracle computes a one-parameter conformal correction (static or rolling), classifies the forecast as signal-preserving or replacement, and reports a full backtest panel.

The core install is dependency-agnostic: it needs only NumPy, pandas, SciPy, statsmodels, and matplotlib. No forecaster library is required unless you use the built-in benchmark wrappers.

Implements the methodology from:

Pele, D.T., Bolovaneanu, V., Ginavar, A.T., Lessmann, S., Hardle, W.K. "Recalibrating Tail Event Forecasts under Temporal Dependence" (2026).

Install

pip install conformal-oracle                 # core (no arch dep)
pip install conformal-oracle[benchmarks]     # + GJR-GARCH, GARCH-Normal
pip install conformal-oracle[chronos]        # + Chronos TSFM
pip install conformal-oracle[all]            # everything

For development:

git clone https://github.com/QuantLet/Conformal_Oracle.git
cd Conformal_Oracle/python
pip install -e ".[dev,benchmarks]"

Quickstart -- agnostic audit (no forecaster dependency)

import pandas as pd
from conformal_oracle import audit

returns = pd.read_csv("returns.csv", index_col=0, parse_dates=True).squeeze()
# q_lo: your model's predicted 1% quantile, same index as returns
q_lo = pd.read_csv("my_var_forecast.csv", index_col=0, parse_dates=True).squeeze()

result = audit(returns, forecast=q_lo, alpha=0.01, mode="static")
print(result.summary())

No arch, no torch, no heavyweight dependency -- just your quantile series.

Quickstart -- with a forecaster object

from conformal_oracle import audit
from conformal_oracle.contrib.benchmarks import GJRGARCHForecaster

result = audit(returns, GJRGARCHForecaster(), alpha=0.01, mode="rolling")
print(result.summary())

Regime classification

from conformal_oracle import classify_regime

verdict = classify_regime(returns, forecast=q_lo, mode="rolling")
print(verdict.regime)       # "signal-preserving" or "replacement"
print(verdict.R)            # replacement ratio
print(verdict.basel_zone)   # "green", "yellow", or "red"

Compare multiple forecasters

from conformal_oracle import compare_forecasters

comp = compare_forecasters(
    returns,
    {"model_A": q_lo_A, "model_B": q_lo_B},
    mode="rolling",
)
print(comp.comparison_table())
print(comp.dm_matrix())

Custom forecaster

Any object implementing fit(returns) and forecast(returns, t) works:

from conformal_oracle._types import SampleDistribution

class MyForecaster:
    def fit(self, returns): pass
    def forecast(self, returns, t):
        hist = returns.iloc[max(0, t-250):t]
        return SampleDistribution(samples=hist.values)

result = audit(returns, MyForecaster(), alpha=0.01)

Worked examples

Documentation

Requirements

Python 3.10+, numpy, pandas, scipy, statsmodels, matplotlib.

GARCH benchmarks require arch>=6.0 (install with [benchmarks]). TSFM wrappers require PyTorch and model-specific packages (see extras).

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

conformal_oracle-0.3.0.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

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

conformal_oracle-0.3.0-py3-none-any.whl (76.5 kB view details)

Uploaded Python 3

File details

Details for the file conformal_oracle-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for conformal_oracle-0.3.0.tar.gz
Algorithm Hash digest
SHA256 21a84bf89b3df95a46a0549b16715c206975a26a94f37fb4d9f5f630985e3d70
MD5 730dfc566f45a19b299706fb2b06b8b1
BLAKE2b-256 8527525c77baf5a90ec63e3966823443ca9e0dab772f87777b5e49ca29d449e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for conformal_oracle-0.3.0.tar.gz:

Publisher: release.yml on danpele/Conformal_Oracle

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

File details

Details for the file conformal_oracle-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for conformal_oracle-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05bc3f27559caa5ce25f06b133c0f09370adb25ce5c2126e8fa0a3bb3dedcdde
MD5 72cae3615ac70709c1b6ca151407672c
BLAKE2b-256 27a70e7296c9496cf5df768f46421171cb8f78f12eee40bf0042597fc77e0ca2

See more details on using hashes here.

Provenance

The following attestation bundles were made for conformal_oracle-0.3.0-py3-none-any.whl:

Publisher: release.yml on danpele/Conformal_Oracle

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