Conformal coverage assumptions
Quick answer
Split conformal prediction constructs intervals or sets using scores from a held-out calibration sample. For regression, absolute residuals can produce intervals around a frozen point predictor with finite-sample marginal coverage under exchangeability. Examples are static Python snippets tested locally on CPU; Native detector examples require NumPy and scikit-learn; exercises use standard-library Python. ByteMind execution is unverified.
Finite-sample rank
from fractions import Fractionfrom math import ceils=[1,2,2,4,7,9,10,11,12]k=ceil((len(s)+1)*Fraction(4,5))print(k,20-s[k-1],20+s[k-1])Expected output (locally tested): 8 9 31. The eighth sorted score is 11; use the order statistic, not interpolation.
How it works
Fit the predictor on training data. For n calibration observations compute s_i=|y_i-f(x_i)|, then sort scores. Given target miscoverage alpha between zero and one, k=ceil((n+1)*(1-alpha)). Use the kth smallest score (one-based) if k<=n, otherwise an infinite radius: the requested finite-sample coverage cannot be achieved by this rank rule with a finite calibration maximum. For a new x return [f(x)-q,f(x)+q]. Under exchangeability of the n calibration scores and the future score conditional on training, its rank is uniform without ties, yielding marginal coverage at least 1-alpha; including ties conservatively preserves the lower bound. This is not conditional coverage for every x or simultaneous coverage of a batch. For n=19 and alpha=0.1, k=18; n=4 gives k=5, hence infinite radius. Use exact rational arithmetic for integer percent examples to avoid accidental rank errors. Evaluate observed coverage as the fraction of held-out targets inside inclusive intervals and report widths. Do not select the predictor or score definition on the same calibration residuals without accounting for selection. Temporal dependence and drift can violate exchangeability; a chronological holdout is useful for detecting degradation but does not restore the theorem. Report coverage separately by time regime and anomaly status, without adapting the radius using final labels. Human review and recalibration need fresh data and a new evaluation protocol.
Impossible finite rank
from math import ceilfrom fractions import Fractions=[1,2,3,4];k=ceil((len(s)+1)*Fraction(9,10))print(k, "unbounded" if k>len(s) else sorted(s)[k-1])Expected output (locally tested): 5 unbounded. The finite calibration maximum is not substituted for the impossible rank.
Common mistakes
Do not use the ordinary interpolated quantile, clip an impossible rank to n, confuse marginal and conditional coverage, or assert a distribution-free guarantee for arbitrary drifting streams.
Practice and next steps
For calibration scores [1,2,2,4,7,9,10,11,12] and 80% nominal coverage, compute k and interval for prediction 20. Then request 99% and explain the infinite radius.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Conformal coverage assumptions — knowledge check
Apply conformal coverage assumptions to small examples and debugging scenarios.
Which rows determine split conformal radius?
Which rank is correct?
What if rank exceeds n?
What coverage is guaranteed under exchangeability?
Does chronological splitting restore exchangeability?