Conformal Prediction - Overview

Summary

Conformal prediction (a.k.a. conformal inference) wraps any fitted predictor — a neural net, a gradient-boosted forest, a Bayesian posterior predictive — and converts its heuristic notion of uncertainty into a prediction set with a finite-sample, distribution-free guarantee . The only assumption is exchangeability of calibration and test points; no model has to be correct and no asymptotics are invoked. The cluster is anchored on Angelopoulos & Bates (2021), with Romano, Patterson & Candès (2019) for CQR, Tibshirani, Barber, Candès & Ramdas (2019) for weighted conformal prediction under covariate shift, and Lei & Candès (2020) for the causal bridge to counterfactuals and ITEs.

Overview

Angelopoulos & Bates frame conformal prediction as a machine that takes “any heuristic notion of uncertainty from any model and converts it to a rigorous one” (Sec. 1.1). The procedure needs three ingredients: a pre-trained model , a score function where larger means worse agreement between and , and fresh calibration pairs unseen during training. The recipe (Sec. 1.1, p. 5):

  1. Identify a heuristic notion of uncertainty from the pre-trained model.
  2. Define the score function .
  3. Compute as the empirical quantile of the calibration scores .
  4. Output .

This is split (inductive) conformal prediction, the variant used almost everywhere in practice; its guarantee and proof are in Split Conformal Prediction and the Coverage Guarantee. Because validity holds for any score, the score determines only the usefulness (size, adaptivity) of the sets — never their validity. Designing scores is therefore the main engineering decision; see Conformity Scores and Adaptive Prediction Sets and Conformalized Quantile Regression.

The guarantee is marginal: it averages over the calibration data and the test point. It does not say that coverage is for a particular ; that stronger conditional property is provably impossible without assumptions. Marginal vs Conditional Coverage covers the distinction, the impossibility result, diagnostics (FSC/SSC metrics) and partial fixes (group-balanced and class-conditional conformal).

When test covariates come from a different distribution than the calibration covariates, exchangeability fails but can be restored by likelihood-ratio reweighting — see Conformal Prediction Under Covariate Shift. That single idea is what lets Lei & Candès treat the missing potential outcome as a covariate-shift prediction problem with propensity-score weights: Conformal Inference for Counterfactuals and ITEs.

Main Content

Prediction set and marginal coverage ^def-marginal-coverage

Given calibration data and a fresh test point from the same distribution, a set-valued function is valid at level if

The probability is over the randomness in both the calibration points and the test point (A&B Eq. 1). The upper bound requires continuous scores (no ties).

Distribution-free ^def-distribution-free

In the sense of A&B Sec. 7, a method is distribution-free if it is (1) agnostic to the model, (2) agnostic to the data distribution, and (3) valid in finite samples. Permutation tests, quantile regression, rank tests and the bootstrap have a claim to the term only in weaker or asymptotic senses.

Conformal coverage guarantee (Vovk, Gammerman & Saunders; A&B Theorem 1) ^thm-conformal-coverage

Suppose and are i.i.d. (exchangeable suffices). With and defined as in steps 3–4 above,

The family of conformal methods

VariantModel fitsData useWhere
Split / inductive conformal1separate train and calibration foldsSplit Conformal Prediction and the Coverage Guarantee
Full / transductive conformalall data for fitting and calibrationA&B Sec. 6.1, below
Cross-conformal, CV+, jackknife+ or all data, intermediate costA&B Sec. 6.2 (pointer only)
Weighted conformal1 (split)calibration scores reweighted by Conformal Prediction Under Covariate Shift

Full conformal prediction ^def-full-conformal

For exchangeable and each candidate : fit a permutation-invariant model on the augmented data ; compute and ; let be the quantile of . Then

satisfies (A&B Theorem 5). Historically this came first; split conformal was later recognised as a special case in which the model is frozen.

Conformal prediction is a permutation test, inverted. A&B (Sec. 6.1, p. 28) note that is exactly the acceptance region of a level- permutation test of exchangeability between the hypothesised point and the data. The prediction set is the set of values the test fails to reject. This is the same logical move as inverting a Fisher randomization test to obtain a confidence set, and explains why exchangeability — the working assumption of Permutation Tests and Exact Inference — is the only assumption needed.

Extensions catalogued by Angelopoulos & Bates (Sec. 4)

  • Group-balanced and class-conditional conformal (Secs. 4.1–4.2): calibrate separately per group or per true class → Marginal vs Conditional Coverage.
  • Conformal risk control (Sec. 4.3, Theorem 2): for any bounded loss monotone non-increasing in , choose ; then . Miscoverage is the special case . With , , the empirical risk target is rather than .
  • Outlier detection (Sec. 4.4): score only ; flag outlier if ; false-positive rate on clean data. Equivalent to a conformal -value below .
  • Covariate shift (Sec. 4.5) → Conformal Prediction Under Covariate Shift.
  • Distribution drift (Sec. 4.6): down-weight old calibration scores; see the theorem below.

Coverage under distribution drift (Barber et al.; A&B Theorem 4) ^thm-drift

Let the calibration points be drawn independently from possibly different distributions, fix weights , normalise , take , and let . Then

Practical schedules: a rolling window or exponential decay . With there is no coverage loss for any weights. The price is a smaller effective sample size and hence more variable realised coverage. This is the honest route for time-series data, where exchangeability is false.

Relevance to marketing measurement and applied work

  • Black-box response models. Any ML demand or conversion model (boosted trees, neural nets) can be given valid predictive intervals with a held-out calibration fold and ~10 lines of code, without trusting the model’s own variance estimates.
  • MMM and time series. Weekly MMM data are not exchangeable, so vanilla split conformal is not justified for forecasts from a Bayesian MMM or a Bayesian Structural Time-Series Model. The drift-weighted version above gives a quantified coverage loss rather than a guarantee. Conformal intervals complement — they do not replace — posterior predictive intervals checked with Posterior Predictive Checking and Cross Validation Checking.
  • Bayes + conformal. Using the posterior predictive density as the score (“conformalizing Bayes”, A&B Sec. 2.4) keeps the Bayesian model’s shape information while making coverage robust to misspecification.
  • Geo experiments and counterfactuals. Predicting the untreated outcome of treated geos is a counterfactual prediction problem; placebo/permutation inference in Synthetic Control Inference and Diagnostics is a close cousin of the conformal construction, and Conformal Inference for Counterfactuals and ITEs makes the link formal under ignorability.
  • Uplift / targeting. ITE intervals allow “treat only if the lower bound is positive” rules with controlled error, in contrast to CATE point estimates from Metalearners for CATE.

Examples

A complete split-conformal classifier in the style of A&B Figure 2 (softmax score ):

import numpy as np
 
def conformal_sets(cal_probs, cal_labels, test_probs, alpha=0.1):
    n = len(cal_labels)
    scores = 1.0 - cal_probs[np.arange(n), cal_labels]      # 1: conformal scores
    q_level = np.ceil((n + 1) * (1 - alpha)) / n            # 2: finite-sample corrected level
    qhat = np.quantile(scores, q_level, method="higher")
    return test_probs >= (1.0 - qhat)                       # 3: boolean matrix = prediction sets

With calibration images and , at least 90% of true-class softmax outputs on future data lie above , so collecting every class above that threshold covers the truth with probability — whether or not the softmax probabilities are calibrated. A&B Figure 1 shows the resulting ImageNet sets growing as the fox squirrel images become progressively harder.

Connections

See Also