Skip to main content
QUICK REVIEW

[Paper Review] Conditional Generative Models for Counterfactual Explanations

Arnaud Van Looveren, Janis Klaise|arXiv (Cornell University)|Jan 25, 2021
Explainable Artificial Intelligence (XAI)Computer Science29 references7 citations
TL;DR

This paper proposes a conditional generative model framework to generate sparse, in-distribution counterfactual explanations for machine learning predictions across images, time series, and tabular data. By training a generative model to produce counterfactual instances in a single forward pass, the method achieves state-of-the-art performance in both in-distribution quality and sparsity while enabling batch generation without iterative optimization.

ABSTRACT

Counterfactual instances offer human-interpretable insight into the local behaviour of machine learning models. We propose a general framework to generate sparse, in-distribution counterfactual model explanations which match a desired target prediction with a conditional generative model, allowing batches of counterfactual instances to be generated with a single forward pass. The method is flexible with respect to the type of generative model used as well as the task of the underlying predictive model. This allows straightforward application of the framework to different modalities such as images, time series or tabular data as well as generative model paradigms such as GANs or autoencoders and predictive tasks like classification or regression. We illustrate the effectiveness of our method on image (CelebA), time series (ECG) and mixed-type tabular (Adult Census) data.

Motivation & Objective

  • To address the scalability and realism limitations of existing counterfactual generation methods that rely on iterative optimization per instance.
  • To develop a general, modality-agnostic framework for generating counterfactuals that are both sparse and in-distribution relative to the training data.
  • To enable batch generation of counterfactuals with a single forward pass using conditional generative models, improving efficiency over optimization-based baselines.
  • To demonstrate the method’s effectiveness across diverse data modalities, including images (CelebA), time series (ECG), and mixed-type tabular data (Adult Census).

Proposed method

  • The method employs a conditional generative model $ G_{\text{CF}} $ trained to map original instances $ x $ and target predictions $ y_T $ to counterfactual instances $ x_{\text{CF}} $, ensuring the model's prediction on $ x_{\text{CF}} $ matches $ y_T $.
  • The generative model is trained using a combination of adversarial loss, reconstruction loss, and an $ L_1 $-based sparsity penalty to ensure realism and minimal feature perturbations.
  • The framework is compatible with various generative models (e.g., GANs, VAEs, autoencoders) and predictive tasks (classification, regression), enabling broad applicability.
  • For tabular data, the method uses a conditional GAN with $ w_G = 1 $, $ w_M = 1 $, and $ w_{L_1} = 10 $, and applies one-hot encoding and normalization to handle mixed feature types.
  • The model is trained end-to-end to generate counterfactuals that are both close to the original instance (sparsity) and statistically similar to real data (in-distributionness).
  • Counterfactuals are generated in a single forward pass, eliminating the need for per-instance optimization, which significantly improves inference speed.

Experimental results

Research questions

  • RQ1Can a conditional generative model generate counterfactual instances that are both sparse and in-distribution across diverse data modalities?
  • RQ2How does the proposed method compare to optimization-based baselines in terms of counterfactual quality and generation efficiency?
  • RQ3To what extent can the framework generalize across different data types, including images, time series, and mixed-type tabular data?
  • RQ4Does the use of generative modeling improve class-conditional in-distributionness compared to existing counterfactual generation methods?
  • RQ5Can the method maintain high-quality counterfactuals while enabling batch generation without iterative optimization?

Key findings

  • The proposed method achieved the lowest MMD² distance (0.021) to the overall data distribution and 0.015 to the class-conditional distribution on the Adult Census dataset, outperforming DiCE and CFProto.
  • On tabular data, the method achieved an $ L_1 $ distance of 0.065 and $ L_0 $ distance of 2.13, indicating high sparsity while maintaining strong in-distribution quality.
  • For image data (CelebA), the method generated counterfactuals that were visually realistic and preserved semantic attributes, with minimal perturbations compared to baselines.
  • On ECG time series, the generated counterfactuals were physiologically plausible and matched the target prediction with minimal feature changes.
  • The method consistently outperformed DiCE and CFProto in preserving class-specific data distributions, as confirmed by UMAP visualizations and MMD scores.
  • The framework enabled batch generation of counterfactuals with a single forward pass, significantly improving inference speed over iterative optimization methods.

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.