Counterfactual Explanations
Also known as: Algorithmic Recourse, Contrastive Explanations, What-If Explanations, Karşıolgusal Açıklamalar
Counterfactual explanations, introduced by Wachter, Mittelstadt, and Russell in 2017, answer the question: 'What is the smallest change to the input that would have produced a different model output?' Rather than explaining why a model made a decision, they describe what would need to change for that decision to be reversed, making them particularly valuable for high-stakes applications such as credit scoring, medical diagnosis, and hiring decisions under frameworks like the EU GDPR.
Read the full method
Sign in with a free account to read this section.
Method map
The neighbourhood of related methods — select a node to explore.
When to use it
Use counterfactual explanations when stakeholders need actionable, individual-level explanations for automated decisions—especially in regulated domains (credit, insurance, medicine, hiring) where subjects have a right to explanation. The method is model-agnostic and requires only black-box query access, though gradient-based variants need a differentiable model. Avoid using this method as a primary auditing tool for detecting global model bias; for that, prefer global methods such as SHAP or partial dependence plots. Also consider that multiple valid counterfactuals may exist and the choice among them requires explicit criteria.
Strengths & limitations
- Model-agnostic: works with any classifier or regressor that can be queried
- Actionable and human-interpretable: directly tells users what to change to obtain a different outcome
- Legally relevant: aligns with GDPR Article 22 right-to-explanation requirements for automated decisions
- No need to expose model internals, preserving intellectual property and privacy
- May produce counterfactuals with unrealistic or immutable feature combinations (e.g., changing age or race)
- Multiple counterfactuals can exist with no principled way to choose among them without additional criteria
- Proximity alone does not guarantee feasibility or causally valid recourse for the affected individual
- Gradient-based search is limited to differentiable models; black-box search can be computationally expensive
Frequently asked
Do counterfactual explanations reveal the model's internal parameters?
No. The method requires only query access to the model's predictions, not its weights or architecture. This makes it safe to deploy when the model is proprietary, and it remains applicable to any black-box system. However, repeated queries can, in theory, be used to reconstruct approximate model behavior, so deployment contexts should consider query-rate controls.
How is a counterfactual different from a sensitivity analysis or LIME explanation?
Sensitivity analysis and LIME explain how the model's output changes as inputs vary locally, providing feature importance scores. Counterfactual explanations instead identify a specific alternative input that achieves a particular target outcome. The counterfactual is prescriptive and contrastive ('change these features to get this result'), whereas LIME is descriptive ('these features were most influential for this prediction').
What does 'actionable' mean for a counterfactual, and why does it matter?
An actionable counterfactual suggests changes to features that the individual can realistically alter, such as income, savings, or debt, rather than immutable attributes such as age or nationality. Actionability matters because the primary value of counterfactual explanations is to provide recourse. If the suggested changes are impossible, the explanation is technically valid but practically useless and may even cause harm by raising false hope or implying that protected attributes influenced the decision.
Sources
- Wachter, S., Mittelstadt, B., & Russell, C. (2017). Counterfactual explanations without opening the black box: Automated decisions and the GDPR. Harvard Journal of Law & Technology, 31, 841–887. link ↗
How to cite this page
ScholarGate. (2026, June 2). Counterfactual Explanations. ScholarGate. https://scholargate.app/en/machine-learning/counterfactual-explanations
Which method?
Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.
- LIMEMachine learning↔ compare
- Logistic RegressionResearch Statistics↔ compare