Individualised Counterfactual Examples Using Conformal Prediction Intervals

James M. Adams, Gesine Reinert, Lukasz Szpruch, Carsten Maple, Andrew Elliott

Abstract

This paper introduces a novel method for generating counterfactual explanations tailored to an individual's specific, limited knowledge of a black-box model. By using the width of conformal prediction intervals to measure uncertainty, the approach selects counterfactuals that are not only close to the original input but also maximally informative. The authors demonstrate that using these "Individualised Conformal Prediction Interval Counterfactuals" (CPICFs) for data augmentation significantly improves model performance on both synthetic and complex fraud detection datasets.

Introduction

Counterfactual explanations are a popular way to interpret black-box algorithmic decisions by showing what features need to change to flip the outcome (e.g., "If your income was $10k higher, your loan would be approved"). However, in high-dimensional feature spaces, there are infinitely many valid counterfactuals. Standard methods usually prioritize the "closest" counterfactual by minimizing a distance metric.

This paper challenges the assumption that the closest counterfactual is the most useful. Existing methods often assume a global view of the model, whereas in reality, a user or a smaller entity only has a limited view based on their own historical interactions. The authors propose generating counterfactuals that provide maximum information gain specifically for the individual receiving it, targeting areas where their personal understanding of the decision boundary is most uncertain.

Methodology

To generate highly informative counterfactuals, the authors propose a pipeline that models user knowledge and quantifies uncertainty using Conformal Prediction.

The proposed pipeline for generating Individualised Conformal Prediction Interval Counterfactuals (CPICFs).

The process involves four key steps:

  1. Model the User's Knowledge: The system represents the user's knowledge as a surrogate model trained only on a subset of the data the user has access to.
  2. Quantify Uncertainty: Locally Weighted Conformal Predictors (LWCP) and Conformalized Quantile Regression (CQR) are used to generate prediction intervals for class probabilities. A wider interval indicates higher uncertainty in the user's knowledge.
  3. Optimize for Information: Counterfactual generation is framed as a constrained minimization problem with two competing objectives: minimizing the distance to the original point (using Weighted Gower distance) and maximizing uncertainty (minimizing the inverse of the conformal prediction interval width).
  4. Generation: A genetic algorithm (pymoo) solves this optimization problem to yield a Conformal Prediction Interval Counterfactual (CPICF).

Experimental Setup

The method was evaluated on two distinct datasets:

  • Synthetic Hypercube: A 30,000-sample binary classification dataset with a 90/10 class imbalance. Its low dimensionality allows for clear visualization of decision boundaries and prediction intervals.
  • Tabformer: A synthetic, complex transaction fraud dataset containing 24 million transactions. It features continuous and categorical variables, temporal shifts, and an extreme class imbalance (<1% fraud).

Results and Discussion

The core insight of this work is that a counterfactual is most valuable when it teaches the user something new. By targeting regions with wide conformal prediction intervals, the counterfactual acts as a highly informative probe into the model's blind spots.

Key Results

  • Hypercube Data Augmentation: Augmenting a small training set (50 samples) with just one CPICF per sample boosted the model's Average Precision from 0.79 to 0.88 and its F1 score from 0.76 to 0.85.
  • Tabformer (Fraud) Augmentation: Using CPICFs for data augmentation significantly outperformed unconstrained counterfactuals. Adding four CPICF augmentations per sample raised the Average Precision from ~0.30 to over 0.50.
  • Local Probability Shift: Quantitatively, adding a CPICF moves the user's local prediction probabilities significantly closer to the "oracle" (full-knowledge) model compared to standard, purely distance-based counterfactuals.

Conclusion and Future Work

While promising, the use of CPICFs introduces new challenges. Standard conformal prediction requires data exchangeability, which is broken when generated counterfactuals are added back into the dataset. Future work will investigate randomizing intervals to restore theoretical coverage guarantees. Additionally, the authors suggest exploring end-to-end conformal training to improve data efficiency and using concurrent quantile regression models to prevent "quantile crossing" (negative interval widths). Finally, the sensitivity of the trade-off parameter ($\lambda$) between distance and uncertainty remains an area for further investigation.

Summary updated

BibTeX
@inproceedings{adams2025individualised,
  author = {James M. Adams and Gesine Reinert and Lukasz Szpruch and Carsten Maple and Andrew Elliott},
  title = {{Individualised Counterfactual Examples Using Conformal Prediction Intervals}},
  booktitle = {COPA},
  year = {2025},
  url = {https://openreview.net/forum?id=FZ3hZYqL1U},
}
Figure