Forecasting intervals: which method, when¶
pyconformal has every method ranked by the largest study of conformal forecasting (all 66 places, with the study's intervals) (Manokhin, Nurmatov, Sreenivas and Liang 2026, doi:10.5281/zenodo.24715782). This page says which to start with. Places and scores (rcWIS, below 1 is better than split conformal) are the study's.
| Your situation | Start with | Study place (rcWIS) | Page |
|---|---|---|---|
| Only the series, no model | CSPAuto |
1st and 2nd (0.757, 0.760) | Conformal seasonal pools |
| You have one-step forecasts and the errors drift | RCI, AgACI, DtACI |
4th (0.796), 3rd (0.793) with clipping, 8th (0.830) | ACI, trackers |
| A model and no separate calibration data | EnbPI |
5th (0.804) | EnbPI, SPCI, KOWCPI |
| Several steps ahead at once | MultiStepSplitConformal, AcMCP |
AcMCP 54th (3.611) at one step; several steps not in the study | Multi-step |
| Many quantile levels that must not cross | MultiQT |
12th scaled (0.850) | MultiQT |
| Compare your own method the study's way | evaluation |
Evaluation | |
| A method from further down the ranking, or the whole ranking | DDCI, ECI, WangHyndmanACP, ResCP, CPTC, ... |
31st to 66th | Places 31 to 66 |
Two things hold for all of them. alpha is the share of misses you accept (0.1 for a 90% interval), and every
online method has run(...), which replays a history and gives the interval issued before each value was seen.
For the clipped variants that the study ran, see clipping: they never give an
infinite interval, and in exchange their guarantee no longer holds.
Examples¶
Copy, paste, run.
import numpy as np
rng = np.random.default_rng(0)
t = np.arange(2000)
y = 20 + 3 * np.sin(2 * np.pi * t / 24) + np.cumsum(rng.normal(0, 0.05, t.size)) + rng.normal(0, 1, t.size)
history, future = y[:1700], y[1700:]
Only the series: conformal seasonal pools choose the target and the season themselves.
from pyconformal import CSPAuto
csp = CSPAuto(random_state=0, max_origins=100).fit(history, seasonal_period=24)
forecast = csp.predict(H=24, alpha=0.1, n_samples=200) # the next 24 steps
print(csp.target_, csp.seasonal_period_)
One-step forecasts with drifting errors: here the forecast is yesterday's value at the same hour.
from pyconformal import RCI
f = y[1676:-24] # forecast for each hour of `future`: the value 24 hours earlier
cal_errors = history[24:] - history[:-24]
res = RCI(alpha=0.1).calibrate(residuals=cal_errors).run(y_pred=f, y=future)
print("RCI coverage", round(res.coverage, 3))
A model, no calibration set: EnbPI trains bootstrap copies and uses their out-of-bag errors.
from pyconformal.point_models import Ridge
from pyconformal import EnbPI
L = 24
X = np.column_stack([y[L - k - 1: -k - 1] for k in range(L)])
target = y[L:]
enb = EnbPI(Ridge(), alpha=0.1, n_bootstraps=20, random_state=0).fit(X[:1676], target[:1676])
res = enb.run(X[1676:], target[1676:], alpha=[0.1, 0.2])
print("EnbPI intervals", res.intervals.shape) # (300, 2, 2)
Your own method, scored like the study: interval score relative to split conformal on the same series.
from pyconformal import evaluation as ev
ref = ev.SplitConformalReference(Ridge()).fit(X[:1676], target[:1676])
lo, hi = ref.predict_interval(X[1676:], alpha=[0.1])[:, :, 0].T
mine = ev.distribution_metrics(target[1676:], ref.predict(X[1676:]), res.intervals[:, 0, :1].T, res.intervals[:, 1, :1].T, [0.1])["wis"]
base = ev.distribution_metrics(target[1676:], ref.predict(X[1676:]), lo[None, :], hi[None, :], [0.1])["wis"]
print("EnbPI against split conformal (rcWIS on one series)", round(mine / base, 3))