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
- Quickstart (S&P 500) --
Static and rolling conformal audits with GJR-GARCH and Lag-Llama.
- Reproduce Table 4 (Full replication) --
9 forecasters x 24 assets, full master evaluation table with checkpointing.
Documentation
- API Reference
- Methodology
- Conventions (return units, VaR sign, alpha)
- Migration Guide (v0.3)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21a84bf89b3df95a46a0549b16715c206975a26a94f37fb4d9f5f630985e3d70
|
|
| MD5 |
730dfc566f45a19b299706fb2b06b8b1
|
|
| BLAKE2b-256 |
8527525c77baf5a90ec63e3966823443ca9e0dab772f87777b5e49ca29d449e1
|
Provenance
The following attestation bundles were made for conformal_oracle-0.3.0.tar.gz:
Publisher:
release.yml on danpele/Conformal_Oracle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conformal_oracle-0.3.0.tar.gz -
Subject digest:
21a84bf89b3df95a46a0549b16715c206975a26a94f37fb4d9f5f630985e3d70 - Sigstore transparency entry: 1519318704
- Sigstore integration time:
-
Permalink:
danpele/Conformal_Oracle@4129593f7c86dde85fe3baafd7d0d9bf8cb5ccb6 -
Branch / Tag:
refs/tags/v0.3.0-python - Owner: https://github.com/danpele
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4129593f7c86dde85fe3baafd7d0d9bf8cb5ccb6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file conformal_oracle-0.3.0-py3-none-any.whl.
File metadata
- Download URL: conformal_oracle-0.3.0-py3-none-any.whl
- Upload date:
- Size: 76.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05bc3f27559caa5ce25f06b133c0f09370adb25ce5c2126e8fa0a3bb3dedcdde
|
|
| MD5 |
72cae3615ac70709c1b6ca151407672c
|
|
| BLAKE2b-256 |
27a70e7296c9496cf5df768f46421171cb8f78f12eee40bf0042597fc77e0ca2
|
Provenance
The following attestation bundles were made for conformal_oracle-0.3.0-py3-none-any.whl:
Publisher:
release.yml on danpele/Conformal_Oracle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conformal_oracle-0.3.0-py3-none-any.whl -
Subject digest:
05bc3f27559caa5ce25f06b133c0f09370adb25ce5c2126e8fa0a3bb3dedcdde - Sigstore transparency entry: 1519318720
- Sigstore integration time:
-
Permalink:
danpele/Conformal_Oracle@4129593f7c86dde85fe3baafd7d0d9bf8cb5ccb6 -
Branch / Tag:
refs/tags/v0.3.0-python - Owner: https://github.com/danpele
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4129593f7c86dde85fe3baafd7d0d9bf8cb5ccb6 -
Trigger Event:
push
-
Statement type: