English

counterfactuals: An R Package for Counterfactual Explanation Methods

Machine Learning 2023-09-19 v2 Machine Learning Computation

Abstract

Counterfactual explanation methods provide information on how feature values of individual observations must be changed to obtain a desired prediction. Despite the increasing amount of proposed methods in research, only a few implementations exist whose interfaces and requirements vary widely. In this work, we introduce the counterfactuals R package, which provides a modular and unified R6-based interface for counterfactual explanation methods. We implemented three existing counterfactual explanation methods and propose some optional methodological extensions to generalize these methods to different scenarios and to make them more comparable. We explain the structure and workflow of the package using real use cases and show how to integrate additional counterfactual explanation methods into the package. In addition, we compared the implemented methods for a variety of models and datasets with regard to the quality of their counterfactual explanations and their runtime behavior.

Keywords

Cite

@article{arxiv.2304.06569,
  title  = {counterfactuals: An R Package for Counterfactual Explanation Methods},
  author = {Susanne Dandl and Andreas Hofheinz and Martin Binder and Bernd Bischl and Giuseppe Casalicchio},
  journal= {arXiv preprint arXiv:2304.06569},
  year   = {2023}
}

Comments

49 pages LaTeX, updated benchmark results

R2 v1 2026-06-28T10:04:44.217Z