Note ConformalForecast is in alpha. APIs are unstable until v0.2.0 and may change without a deprecation cycle.
Installation
Install ConformalForecast from PyPI:numpy, narwhals, pydantic, and scipy.
It installs neither pandas nor polars: the Nixtla adapters accept whichever one
your forecasting library uses.
Everything else is an extra:
Quick start
Calibrate a forecaster on its own cross-validation errors, then predict with intervals:alpha=0.1 asks for 90% coverage. calibrate_cv runs the forecaster’s own
cross-validation, calibrates on the resulting errors and returns a fitted
object; calibrate takes explicit history/truth arrays instead when you
already have them. The method itself is never modified, so one configured
method can calibrate as many forecasters as you like.
See the quick start
for the full walkthrough, including measured coverage on a held-out split.
Methods
The fitted objects of online methods implement
update(prediction, truth),
which advances them in place, so intervals keep recalibrating as new
observations arrive.
Every fitted object offers recalibrate() for a target domain you have labels
for, returning a new fitted object. A fitted WeightedSplit additionally
offers adapt(), which needs only target features or target history — no
target labels at all. See
Transfer and adaptation.
Works with the Nixtlaverse
An adapter is the uniform interface a conformal method talks to. It converts a library’s long-format frames into arrays at the boundary, so the calibration math never sees a DataFrame. Fit your forecaster as usual, then wrap it.StatsForecast
MLForecast
NeuralForecast
Anything else
nixtla
extra. Importing conformalforecast never imports statsforecast, mlforecast,
neuralforecast, or torch. See the
adapters guide
for capability requirements and exogenous handling.
A method and the fitted object it returns
Every method is a pair: a method that is pure configuration, and the fitted object itsfit / calibrate / calibrate_cv returns. The method
is never modified by fitting; everything learned from calibration lives on the
returned object.
score= to the constructor, or leave it
out for the method’s default. An incompatible score is rejected right there.
The forecaster is the one collaborator bound at calibration.
Which entry point you call depends on who owns the cross-validation loop.
The array surface — method.fit(predictions, truths), then
fitted.interval(predictions) and fitted.update(prediction, truth). Pure
array-in/array-out calibration math, taking no forecaster at all. A signature
here may only accept numpy-coercible arrays and plain-Python config — never
adapters, DataFrames, or library types. This is the surface for libraries that
already own their cross-validation and predict orchestration: statsforecast,
mlforecast, neuralforecast.
The forecaster surface — method.calibrate(forecaster, histories, truths)
or method.calibrate_cv(forecaster, n_windows), then
fitted.predict(history). CV/predict dispatch through a ForecasterAdapter,
written once in the base classes. This is the surface for standalone users.
The architecture page
explains when to reach for which.
Features
- Seven conformal methods, four of them online and adaptive
- Declarative methods whose
fitreturns a fitted object, with an array surface for embedding and a forecaster surface for standalone use - Panels are first class — every method is multi-series and multi-horizon
- Ragged panels through NaN masking, with no imputation
- NaN-aware quantiles identical across numpy versions — the exact
ceil((1 - alpha)(n + 1))order statistic for split and CQR float32preserved on the array surface (fit/interval/update)- Exogenous features threaded through
calibrateandpredict(see the roadmap for the limits) - Coverage and interval-quality diagnostics in
conformalforecast.diagnostics - Deterministic given a config and inputs;
seeddefaults to0, neverNone
Why ConformalForecast?
Conformal prediction gives distribution-free coverage guarantees without assuming a noise model. The catch for forecasting is that the classic guarantee assumes exchangeable data, and time series are not exchangeable: they drift, they have regimes, and their errors are serially correlated. This library prioritizes the methods built for that setting. It is designed for:- Adding calibrated intervals to a point forecaster that has none
- Replacing intervals from a model whose distributional assumptions do not hold
- Keeping coverage under distribution shift, via online recalibration
- Auditing whether the intervals you already ship actually cover
- Embedding calibration math directly inside a forecasting library
Documentation
- Getting started
- Tutorials and API reference
- Roadmap — known gaps and limitations
- Contributing
- Changelog
- Support
- Security policy
- Third-party notices
- Code of conduct
- Citation

