# Declarative Approaches to Counterfactual Explanations for Classification

arXiv: https://arxiv.org/abs/2011.07423 · HTML: https://mlsanity.com/paper/2011.07423/

## Key facts

- Cited by 14 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 15 Nov 2020.

## Built on by (most cited first, 14 of 14)

- [ASTERYX : A model-Agnostic SaT-basEd appRoach for sYmbolic and score-based eXplanations](https://mlsanity.com/paper/2206.11900/) (2022)
- [Answer-Set Programs for Reasoning about Counterfactual Interventions and Responsibility Scores for Classification](https://mlsanity.com/paper/2107.10159/) (2021)
- [Efficient Computation of Shap Explanation Scores for Neural Network Classifiers via Knowledge Compilation](https://mlsanity.com/paper/2303.06516/) (2023)
- [From Database Repairs to Causality in Databases and Beyond](https://mlsanity.com/paper/2306.09374/) (2023)
- [Score-Based Explanations in Data Management and Machine Learning: An Answer-Set Programming Approach to Counterfactual Analysis](https://mlsanity.com/paper/2106.10562/) (2021)
- [Attribution-Scores and Causal Counterfactuals as Explanations in Artificial Intelligence](https://mlsanity.com/paper/2303.02829/) (2023)
- [Reason to explain: Interactive contrastive explanations (REASONX)](https://mlsanity.com/paper/2305.18143/) (2023)
- [Attribution-Scores in Data Management and Explainable Machine Learning](https://mlsanity.com/paper/2308.00184/) (2023)
- [The Distributional Uncertainty of the SHAP score in Explainable Machine Learning](https://mlsanity.com/paper/2401.12731/) (2024)
- [Reasoning about Counterfactuals and Explanations: Problems, Results and Directions](https://mlsanity.com/paper/2108.11004/) (2021)
- [Answer-Set Programs for Repair Updates and Counterfactual Interventions](https://mlsanity.com/paper/2209.12110/) (2022)
- [Declarative Reasoning on Explanations Using Constraint Logic Programming](https://mlsanity.com/paper/2309.00422/) (2023)
- [Counterfactual Explanations as Plans](https://mlsanity.com/paper/2502.09205/) (2025)
- [Reconciling Consistency-Based Diagnosis with Actual-Causality-Based Explanations](https://mlsanity.com/paper/2605.08688/) (2026)

## Abstract (arXiv)

We propose answer-set programs that specify and compute counterfactual interventions on entities that are input on a classification model. In relation to the outcome of the model, the resulting counterfactual entities serve as a basis for the definition and computation of causality-based explanation scores for the feature values in the entity under classification, namely "responsibility scores". The approach and the programs can be applied with black-box models, and also with models that can be specified as logic programs, such as rule-based classifiers. The main focus of this work is on the specification and computation of "best" counterfactual entities, i.e. those that lead to maximum responsibility scores. From them one can read off the explanations as maximum responsibility feature values in the original entity. We also extend the programs to bring into the picture semantic or domain knowledge. We show how the approach could be extended by means of probabilistic methods, and how the underlying probability distributions could be modified through the use of constraints. Several examples of programs written in the syntax of the DLV ASP-solver, and run with it, are shown.
