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.
翻译:反事实解释方法提供有关如何更改单个观测值的特征值以获得所需预测的信息。尽管已经提出了越来越多的方法,但只有极少数实现存在,它们的界面和要求各不相同。在本文中,我们介绍了R语言包Counterfactuals,该包提供了基于R6的模块化和统一的界面,用于反事实解释方法。我们实现了三种现有的反事实解释方法,并提出了一些可选的方法论扩展,以将这些方法推广到不同的情况,并使它们更具可比性。我们利用真实的用例解释了包的结构和工作流程,并展示了如何将其他反事实解释方法集成到包中。此外,我们比较了实施的方法在各种模型和数据集上的性能,包括反事实解释的质量和运行时行为。