What is Shapley Additive Explanations (SHAP)?
SHAP is an explanation method finding each input feature's contribution to a single prediction using Shapley values from game theory, computing the average change in output from adding the feature to all possible feature combinations; contributions sum to the difference between the prediction and the average prediction.
Local Interpretable Model-agnostic Explanations reaches the same goal by building a local linear model around the prediction, with results that can vary by sampling; SHAP defines contributions through one solution based on fair allocation principles.
- Topic
- Responsible AI and governance
- Also known as
- Shapley values
- Origin
- 2017
How Shapley Additive Explanations (SHAP) works
- The prediction to explain and a background dataset are chosen; the background's average prediction is the starting point.
- For each feature, how much adding it to different feature subsets changes the prediction is computed and averaged with weights.
- Exact computation grows exponentially, so tree models use fast exact methods and others sampling approximations.
- One prediction's explanation is local; aggregating values over many predictions gives global feature importance.
In more detail
The three axioms and the logic of the Shapley formula
SHAP rests on three formal axioms, local accuracy (contributions plus baseline equal the prediction), missingness (absent features receive zero attribution) and consistency (if a model changes so a feature contributes more, its SHAP value does not decrease). Mathematically, each feature's Shapley value averages its marginal contribution across all subsets S of the other features, weighted by |S|!(M - |S| - 1)! / M!.
The SHAP algorithm family (TreeSHAP, KernelSHAP, DeepSHAP, TokenSHAP)
Different algorithms target specific model families: TreeSHAP computes exact values in polynomial time for gradient-boosted trees (such as XGBoost, LightGBM and CatBoost), LinearSHAP handles linear models, DeepSHAP and GradientSHAP approximate attributions for neural networks and KernelSHAP offers a model-agnostic fallback at higher computational cost. Partition or Token SHAP extends this framework to text and transformer models.
Interventional versus observational background distributions
Choosing between interventional (marginal) and observational (conditional) expectations creates an important trade-off when features are correlated. Interventional SHAP stays faithful to the model's actual computation by breaking feature correlations, which can test unrealistic combinations; observational SHAP respects the data distribution but may assign credit to correlated features the model never explicitly used.
Adversarial scaffolding and complementing with counterfactuals
Post-hoc attribution methods including SHAP can be deceived by adversarial scaffolding classifiers that behave normally on real data yet hide discriminatory logic on out-of-distribution perturbations. In high-stakes regulated domains, SHAP should therefore be paired with fairness audits, counterfactual explanations and domain-expert validation rather than treated as standalone proof of compliance.
Commonly confused terms
| Term | How it differs |
|---|---|
| Local Interpretable Model-agnostic Explanations | LIME fits an interpretable local linear surrogate model around a single prediction via random perturbations, so explanations can fluctuate across runs; SHAP computes unique additive attributions grounded in game-theoretic Shapley axioms. |
| Permutation feature importance and Gini importance | Permutation feature importance measures how much overall model error increases on a dataset when a feature's values are randomly shuffled (global performance sensitivity), whereas SHAP decomposes individual predictions into signed feature contributions relative to a baseline. |
| Partial dependence plots (PDP) and ICE | Partial Dependence Plots (PDP) and Individual Conditional Expectation (ICE) visualise the average or per-instance marginal effect of one or two features across their value range, whereas SHAP attributes the exact difference between a specific prediction and the expected baseline across all features simultaneously. |
Why Shapley Additive Explanations (SHAP) matters for on-premises AI
With contributions summing to the prediction's difference and consistency, SHAP is among the commonest explanation methods in credit, insurance and fraud, serving both individual reasons and overall model review. Points to watch: results depend on the chosen background data, contributions can be split misleadingly among correlated features and computation is costly for large models.
An insurer explains every quote from its renewal pricing model with SHAP values; a sales representative can show a customer which factors raised the premium, while the model risk team aggregates values across the portfolio to monitor overall behaviour.
Common questions
How does SHAP differ from LIME?
LIME builds a local linear model around a prediction, with results that can vary by sampling. SHAP defines contributions by fair allocation principles based on Shapley values.
Do SHAP values show causation?
No. They show how much the model relies on each feature. They do not prove real-world cause and effect.
Related terms
- Feature attribution
- Local interpretable model-agnostic explanations (LIME)
- Integrated gradients
- Explainable AI (XAI)
- AI local interpretability
- Global interpretability
Sources
In the glossary: Glossary, R to Z