CountARFactuals - Generating Plausible Model-Agnostic Counterfactual Explanations with Adversarial Random Forests

Susanne Dandl, Kristin Blesch, Timo Freiesleben, Gunnar König, Jan Kapar, Bernd Bischl, Marvin N. Wright

Abstract

Counterfactual explanations are a popular tool for interpreting black-box machine learning models, providing users with actionable "what-if" scenarios. However, traditional methods often generate counterfactuals that are mathematically close to the original instance but physically impossible or highly unlikely within the real-world data distribution. This paper introduces CountARFactuals, a novel approach that leverages Adversarial Random Forests (ARFs) to ensure the plausibility of generated explanations. By utilizing tree-based density estimation and generative modeling, CountARFactuals handles mixed tabular data more effectively and efficiently than existing deep learning or optimization-based alternatives.

Introduction: The Plausibility Problem

Machine learning models are increasingly used in high-stakes domains like finance and medicine. To provide transparency, counterfactual explanations suggest minimal feature changes to flip a model's prediction (e.g., "If your income were $5,000 higher, your loan would be approved"). A critical challenge is the plausibility problem: many algorithms suggest points that fall into low-density regions of the feature space, representing unrealistic scenarios.

Visualizing the trade-off between proximity and plausibility. Standard methods often select points in low-density gaps (b), whereas CountARFactuals targets realistic data clusters (a).

As illustrated above, standard multi-objective counterfactual (MOC) methods might select a point $x^{cf}$ that is close to the original $x^*$ but resides in a "gap" between actual data clusters. CountARFactuals aims to guide the search toward high-density regions to ensure realistic suggestions.

Methodology: Adversarial Random Forests (ARFs)

The authors propose using Adversarial Random Forests, a generative technique that uses decision trees rather than neural networks. ARFs are composed of two primary elements:

  1. FORDE (Forests for Density Estimation): Measures the likelihood of a data point to penalize "outlier" counterfactuals.
  2. FORGE (Forests for Generative Modeling): Samples new, realistic data points conditioned on existing features.

The paper introduces two ways to use these tools:

  • Algorithm 1 (Integration): They swap the standard plausibility measure in the existing Multi-Objective Counterfactual (MOC) framework with FORDE and use FORGE to "mutate" candidates during the search process.
  • Algorithm 2 (Standalone): A "pure" ARF generator. It uses local feature importance to decide which features to change and then uses FORGE to directly sample new values for those features, conditioned on the features that stay the same.

Experimental Evaluation

The methods were evaluated on synthetic datasets (Cassini, Two Sines, Pawelczyk) and Bayesian networks of varying dimensionality (5 to 20 features) to provide ground-truth likelihoods for testing plausibility. Additionally, the Coffee Quality Dataset was used to demonstrate real-world applicability, showing how a producer might change their process to achieve a "good" quality rating.

Key Results

The ARF-based approach demonstrated significant improvements over baselines like MOC and NICE across several dimensions:

  • Superior Plausibility: ARF-based measures correlated more strongly with ground-truth density (0.84) than k-nearest neighbor approaches (0.69).
  • Computational Efficiency: The standalone ARF method was often orders of magnitude faster than iterative optimization methods, particularly in higher-dimensional spaces.
  • Pareto Dominance: The framework successfully balanced the competing objectives of proximity (closeness to original), sparsity (few features changed), and plausibility.
Benchmark results across six synthetic datasets. ARF-based methods consistently achieve high plausibility and significantly lower runtimes compared to baseline methods.

Conclusion and Future Work

CountARFactuals demonstrates that tree-based generative models are uniquely suited for generating counterfactuals on tabular data. They are easier to train, require less tuning, and respect the natural boundaries of categorical variables. Future work will focus on integrating causal constraints to ensure that "plausible" changes are also "actionable" (e.g., avoiding suggestions to change a user's place of birth) and incorporating user preferences to navigate the "Rashomon Effect" of having multiple valid counterfactual options.

Summary updated

BibTeX
@inproceedings{dandl2024countarfactuals,
  author = {Susanne Dandl and Kristin Blesch and Timo Freiesleben and Gunnar König and Jan Kapar and Bernd Bischl and Marvin N. Wright},
  title = {{CountARFactuals - Generating Plausible Model-Agnostic Counterfactual Explanations with Adversarial Random Forests}},
  booktitle = {xAI},
  year = {2024},
  doi = {10.1007/978-3-031-63800-8\_5},
}
Figure