Skip to main content
QUICK REVIEW

[Paper Review] Inductive Conformal Prediction: A Straightforward Introduction with Examples in Python

Martim Sousa|arXiv (Cornell University)|Jun 23, 2022
Explainable Artificial Intelligence (XAI)Computer Science6 citations
TL;DR

This paper presents inductive conformal prediction (ICP), a distribution-free, model-agnostic method that produces prediction intervals or sets with guaranteed coverage probability. It works by training a model on a training set, computing non-conformity scores on a calibration set, and using quantiles of these scores to form confidence sets; the key contribution is a practical, hands-on tutorial with Python examples demonstrating ICP's application in regression and classification with real-world datasets like Boston housing and CIFAR-10.

ABSTRACT

Inductive Conformal Prediction (ICP) is a set of distribution-free and model agnostic algorithms devised to predict with a user-defined confidence with coverage guarantee. Instead of having point predictions, i.e., a real number in the case of regression or a single class in multi class classification, models calibrated using ICP output an interval or a set of classes, respectively. ICP takes special importance in high-risk settings where we want the true output to belong to the prediction set with high probability. As an example, a classification model might output that given a magnetic resonance image a patient has no latent diseases to report. However, this model output was based on the most likely class, the second most likely class might tell that the patient has a 15% chance of brain tumor or other severe disease and therefore further exams should be conducted. Using ICP is therefore way more informative and we believe that should be the standard way of producing forecasts. This paper is a hands-on introduction, this means that we will provide examples as we introduce the theory.

Motivation & Objective

  • To introduce inductive conformal prediction (ICP) as a distribution-free, model-agnostic method for uncertainty quantification in machine learning.
  • To address the limitations of point predictions by providing prediction intervals or sets with guaranteed statistical coverage.
  • To demonstrate how ICP improves decision-making in high-stakes applications by offering more informative outputs than single-class or point estimates.
  • To compare different non-conformity score strategies—naive, class-balanced, and adaptive prediction sets—for improved calibration and adaptiveness in classification.
  • To provide a practical, code-based tutorial using scikit-learn and Keras to implement ICP on real datasets, promoting adoption in real-world scenarios.

Proposed method

  • Split the dataset into three disjoint sets: training (50%), calibration (25%), and validation (25%) to ensure independence.
  • Train a machine learning model on the training set to generate predictions for the calibration and validation sets.
  • Define a non-conformity score function s(x, y) to quantify prediction error or uncertainty; for regression, s(x, y) = |f(x) - y|; for classification, s(x, y) = 1 - f(x)_y.
  • Compute the (1−α) quantile of non-conformity scores from the calibration set to determine the threshold  q̂, ensuring marginal coverage guarantee.
  • Construct prediction sets C(x_val) as intervals or sets of classes such that y_val ∈ C(x_val) with probability at least 1−α.
  • For adaptive prediction sets, use cumulative softmax probabilities ordered by confidence, including classes from most to least likely until the cumulative sum exceeds  q̂.

Experimental results

Research questions

  • RQ1How can inductive conformal prediction be used to produce prediction sets with guaranteed marginal coverage in regression and classification?
  • RQ2What are the practical differences between naive, class-balanced, and adaptive non-conformity score functions in terms of coverage and set size?
  • RQ3How does the choice of non-conformity score function affect the size and informativeness of prediction sets in real-world applications?
  • RQ4To what extent does ICP maintain coverage across different classes, especially in imbalanced settings, and how can this be improved?
  • RQ5Can conformal prediction be effectively implemented in practice using standard ML frameworks like scikit-learn and Keras with minimal code?

Key findings

  • The naive method for regression achieved a 90% coverage rate with α=0.1, demonstrating the method's ability to produce valid prediction intervals.
  • In classification, the naive method achieved 88.18% validation coverage with α=0.1, confirming the marginal coverage guarantee despite class-specific variability.
  • The class-balanced method improved coverage consistency across classes, reducing over- and under-coverage issues observed in the naive approach.
  • The adaptive prediction sets (APS) method achieved 90.44% validation coverage with α=0.1, showing improved adaptiveness by including classes based on cumulative confidence.
  • APS produced larger prediction sets than the naive method, reflecting its ability to capture uncertainty more comprehensively, especially for ambiguous inputs.
  • Empirical validation using T=100 trials showed that the empirical coverage distribution closely matched the theoretical Beta(n_cal+1−l, l) distribution, confirming correct implementation of ICP.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.