Calculating and Visualizing Counterfactual Feature Importance Values
Bjorge Meulemeester Raphael Mazzine Barbosa De Oliveira David Martens
Despite the success of complex machine learning algorithms, mostly justified
by an outstanding performance in prediction tasks, their inherent opaque nature
still represents a challenge to their responsible application. Counterfactual
explanations surged as one potential solution to explain individual decision
results. However, two major drawbacks directly impact their usability: (1) the
isonomic view of feature changes, in which it is not possible to observe
\textit{how much} each modified feature influences the prediction, and (2) the
lack of graphical resources to visualize the counterfactual explanation. We
introduce Counterfactual Feature (change) Importance (CFI) values as a
solution: a way of assigning an importance value to each feature change in a
given counterfactual explanation. To calculate these values, we propose two
potential CFI methods. One is simple, fast, and has a greedy nature. The other,
coined CounterShapley, provides a way to calculate Shapley values between the
factual-counterfactual pair. Using these importance values, we additionally
introduce three chart types to visualize the counterfactual explanations: (a)
the Greedy chart, which shows a greedy sequential path for prediction score
increase up to predicted class change, (b) the CounterShapley chart, depicting
its respective score in a simple and one-dimensional chart, and finally (c) the
Constellation chart, which shows all possible combinations of feature changes,
and their impact on the model's prediction score. For each of our proposed CFI
methods and visualization schemes, we show how they can provide more
information on counterfactual explanations. Finally, an open-source
implementation is offered, compatible with any counterfactual explanation
generator algorithm. Code repository at:
https://github.com/ADMAntwerp/CounterPlots