Clipping: clip=True on ACI, DtACI, AgACI and BC-ACI, and the weighted empirical quantile¶
An option on four online methods that keeps every interval finite, at the price of the method's guarantee.
| Use it when | You cannot use an infinite interval, or you need to reproduce a library or benchmark that clips. |
| Guarantee | None with clip=True. Without it (the default) each method keeps its own guarantee. |
| In the library | AdaptiveConformalInference(clip=True), DtACI(clip=True), AgACI(clip=True), BCACI(clip=True), WeightedQuantileConformal |
| Source | Gibbs and Candès (2021, 2022); Zaffran et al. (2022); Lade et al. (2026); salesforce/online_conformal (Apache 2.0); Manokhin et al. (2026) |
| Example needs | pyconformal |
No finite-sample or long-run guarantee with clip=True
Clipping \(\alpha_t\) to \([\varepsilon, 1 - \varepsilon]\) guarantees finite intervals at every step, but breaks ACI's distribution-free coverage guarantee: under rapid variance or mean drift, the largest interval is capped at the largest past score in the window. Use clip=False (the default) when guarantees matter, and clip=True only when finite bounds are a hard application requirement.
What clipping changes¶
ACI and the methods built on it move a working level alpha_t after every miss. Their guarantee — the long-run
share of misses is alpha, for any data — needs alpha_t to go below 0 after a run of misses, and then the interval
is the whole real line. Clipping holds alpha_t in [eps, 1 - eps] (DtACI: [0, 1]) and uses the plain empirical
quantile of the kept errors.
clip=False (default) |
clip=True |
|
|---|---|---|
| Long-run miss rate | alpha, for any sequence (ACI, DtACI; BCACI) |
No guarantee: after a shift the widest interval is the largest kept error, so misses can stay above alpha |
| Infinite intervals | Yes, when the data call for them | Never |
| Quantile | Conformal rank ceil((n + 1)(1 - alpha_t)) |
np.quantile (linear) or the inverted empirical CDF: slightly narrower for small windows |
| Matches | The papers' algorithms | MAPIE's, TorchCP's and salesforce's ACI and FACI, and the study's columns |
run(..., batch_size=k) |
Trackers only | Yes |
Why the option is here¶
In the large-scale study of conformal forecasting (Manokhin, Nurmatov, Sreenivas and Liang 2026, doi:10.5281/zenodo.24715782) an infinite interval counts as a failed forecast, and the clipped versions rank far above the guaranteed ones:
| Study column | Clipped: place (rcWIS) | Unclipped: place (rcWIS) | pyconformal |
|---|---|---|---|
| AgACI on EnbPI | 3 (0.793) | — | AgACI(clip=True, window=n) on the EnbPI residual window |
| ACI on EnbPI | 6 (0.819) | 63 (48.7) | AdaptiveConformalInference(gamma=0.05, window=n, clip=True) |
| BCACI | 7 (0.825) | 61 (44.9) | BCACI(clip=True) / BCACI() |
| DtACI | 8 (0.830) | 60 (26.6) | DtACI(interval=100, clip=True) / DtACI() |
Coverage moves the other way: at the 90% level the unclipped ACI covered 88.1% in the study and the clipped one 86.8%. Which one you want depends on whether an infinite interval is usable in your application.
WeightedQuantileConformal is the related simplification of non-exchangeable conformal prediction: the
recency-weighted quantile of past errors with no weight on the test point, always finite, no finite-sample bound
(the study's NexCP, 18th, and WeightedConformal, 19th). The guaranteed version is NonexchangeableConformal.
All of these match the study's code on 13 series and 11 levels to 1e-13, except AgACI(clip=True), whose
aggregation weights are computed from the radii directly; the study's code forms them as a difference of two bounds
near the level of the series, which loses digits when the experts nearly agree. The scores are the same.
Minimal example¶
Copy, paste, run.
import numpy as np
from pyconformal import AdaptiveConformalInference, DtACI, AgACI, BCACI, WeightedQuantileConformal
rng = np.random.default_rng(1)
T = 1000
forecasts = np.zeros(T)
actuals = rng.standard_t(4, size=T) * np.r_[np.ones(500), 6 * np.ones(500)] # errors jump six-fold
cal_errors = actuals[:300] - forecasts[:300]
f_test, y_test = forecasts[300:], actuals[300:]
for name, method in [
("ACI", AdaptiveConformalInference(alpha=0.05, gamma=0.05)),
("ACI clip", AdaptiveConformalInference(alpha=0.05, gamma=0.05, clip=True)),
("DtACI", DtACI(alpha=0.05, interval=100)),
("DtACI clip", DtACI(alpha=0.05, interval=100, clip=True)),
("AgACI", AgACI(alpha=0.05)),
("AgACI clip", AgACI(alpha=0.05, clip=True)),
("BCACI", BCACI(alpha=0.05)),
("BCACI clip", BCACI(alpha=0.05, clip=True)),
("weighted quantile", WeightedQuantileConformal(alpha=0.05, decay=0.99, window="calibration")),
]:
res = method.calibrate(residuals=cal_errors).run(y_pred=f_test, y=y_test)
print(f"{name:18s} coverage {res.coverage:.3f} infinite intervals {int(np.isinf(res.thresholds).sum())}")
More¶
- The online trackers: more online trackers
- The study's protocol and scoring: evaluation