Distribution-free binary classification: prediction sets, confidence intervals and calibration

Chirag Gupta, Aleksandr Podkopaev, Aaditya Ramdas

Abstract

In machine learning, treating model outputs as true probabilities (calibration) is essential for reliable decision-making. However, modern neural networks often lack this property. This paper establishes a formal framework for distribution-free uncertainty quantification (UQ) in binary classification. By proving a "tripod" of relationships between calibration, confidence intervals, and prediction sets, the authors demonstrate that popular smooth calibration methods cannot offer distribution-free guarantees. Instead, they show that nonparametric histogram binning provides a provable path to calibration without requiring distributional assumptions, even in the presence of covariate shift.

Introduction

When a binary classifier outputs a score of 0.9, we ideally expect the true label to be 1 in 90% of such cases. This property, known as calibration, is critical for safety-critical applications. While post-hoc methods like Platt scaling or temperature scaling are widely used, they typically rely on implicit assumptions about the data distribution. If these assumptions fail, the resulting "probabilities" can be misleading.

This research addresses the challenge of providing distribution-free guarantees for three core UQ tasks:

  1. Calibration: Ensuring predicted scores match observed frequencies.
  2. Confidence Intervals (CI): Estimating the range of the true conditional probability $P(Y=1|X)$.
  3. Prediction Sets (PS): Generating a set of labels that contains the true label with a pre-specified probability.

The Theoretical Tripod

The core contribution of this work is the mathematical linkage between these three concepts. The authors establish that these tasks are not independent but form a "tripod" where guarantees in one domain can be translated to another.

The theoretical tripod connecting approximate calibration, confidence intervals, and prediction sets.

As shown in Figure 1, Theorem 1 links confidence intervals to approximate calibration, while Theorem 2 demonstrates how these can lead to valid prediction sets. This unified view suggests that a calibrated model is essentially a collection of valid confidence intervals for every prediction.

Notation and Setup

To formalize these relationships, the authors define a standard notation for calibration data, test points, and the predictors being evaluated.

Summary of notation used for calibration data, test points, and predictors.

The Impossibility of Smooth Calibration

A striking result of this paper is the "impossibility theorem." The authors prove that any injective (one-to-one) calibration function—which includes almost all parametric methods like Platt scaling, Temperature scaling, and Beta calibration—cannot be distribution-free asymptotically calibrated.

The intuition is that smooth, strictly increasing functions preserve too much information about the original features. For a calibration guarantee to hold across all possible distributions, the scoring function must partition the feature space into a countable number of sets, effectively "forgetting" some feature details to gain statistical robustness.

Embracing Nonparametric Binning

Since smooth functions fail the distribution-free test, the authors advocate for histogram binning. While often dismissed as a crude approximation, binning's "lossy" nature is precisely what enables distribution-free guarantees. By grouping points into bins, one can apply concentration inequalities to bound the error.

The authors provide tight finite-sample guarantees using Empirical Bernstein inequalities. These bounds are particularly effective because they tighten as predicted probabilities approach 0 or 1, reflecting the higher certainty in those regions.

Handling Covariate Shift

The paper also extends these results to covariate shift, where the distribution of features $X$ changes between training and testing, but the conditional relationship $P(Y|X)$ remains stable. By deriving a weighted binning estimator, the authors provide the first distribution-free calibration guarantee for this setting. In simulations, this weighted approach significantly outperformed unweighted methods, reducing the Expected Calibration Error (ECE) from 0.047 to 0.017.

Conclusion

This work shifts the perspective on calibration from seeking "smoothness" to seeking "guarantees." By proving that binning is the only path to distribution-free calibration, the authors provide a rigorous foundation for uncertainty quantification in binary classification. For practitioners requiring high-stakes reliability, the message is clear: the statistical power gained from binning outweighs the perceived loss in resolution.

Summary updated

BibTeX
@inproceedings{gupta2020distribution,
  author = {Chirag Gupta and Aleksandr Podkopaev and Aaditya Ramdas},
  title = {{Distribution-free binary classification: prediction sets, confidence intervals and calibration}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=uPXMP_lWMun},
}
Figure