SHAP (SHapley Additive exPlanations)
Also known as: SHAP Değerleri (Model Açıklanabilirlik), Shapley additive explanations, SHAP values, model explainability
SHAP is a model-explanation method, introduced by Scott Lundberg and Su-In Lee in 2017, that uses Shapley values from cooperative game theory to measure how much each feature contributes to an individual prediction, making the output of black-box machine-learning models interpretable. It supports both global explanations (overall feature importance) and local explanations (why one specific prediction came out the way it did).
Key highlights
- Turns black-box models into interpretable ones by attributing each prediction to its features.
- Provides both global feature importance and local single-prediction explanations from one framework.
- Grounded in Shapley values from game theory, giving the attributions a principled, additive fairness basis.
- TreeSHAP gives fast, exact explanations for tree-based models such as random forest and XGBoost.
- KernelSHAP is model-agnostic, so the same approach applies to almost any trained model.
Intuition
This section is available to Pro members. Upgrade to Pro
How it works
This section is available to Pro members. Upgrade to Pro
When to use it
Use SHAP when you already have a trained black-box model (such as XGBoost, random forest, or deep learning) on cross-sectional or panel data with continuous, categorical, or binary features, and you need to explain its predictions rather than just report accuracy. It works at both the global level (which features matter overall) and the local level (why one case was predicted as it was). At least about 30 observations are needed; below that, SHAP values become unstable and a directly interpretable model such as a decision tree is safer.
Strengths & limitations
- Turns black-box models into interpretable ones by attributing each prediction to its features.
- Provides both global feature importance and local single-prediction explanations from one framework.
- Grounded in Shapley values from game theory, giving the attributions a principled, additive fairness basis.
- TreeSHAP gives fast, exact explanations for tree-based models such as random forest and XGBoost.
- KernelSHAP is model-agnostic, so the same approach applies to almost any trained model.
- Requires an already-trained ML model; SHAP explains a model, it does not build one.
- On small samples (n below about 30) SHAP values are unstable and feature contributions become unreliable.
- KernelSHAP is model-agnostic but computationally slow, especially on large datasets or many features.
- Attributions describe the model's behaviour, not the true causal effect of a feature in the world.
Common pitfalls
This section is available to Pro members. Upgrade to Pro
Applications
This section is available to Pro members. Upgrade to Pro
Frequently asked
Do I need to retrain my model to use SHAP?
No. SHAP explains a model you have already trained — such as XGBoost, a random forest, or a deep network — by attributing its existing predictions to the input features. It does not refit or change the model.
What is the difference between TreeSHAP and KernelSHAP?
TreeSHAP computes exact SHAP values quickly for tree-based models like random forest and XGBoost. KernelSHAP is model-agnostic and works for any model, but it is an approximation and is considerably slower, especially on large data.
Can SHAP explain a single prediction?
Yes. That is its local mode: for one case it shows how much each feature pushed the prediction above or below the baseline, with the contributions adding up exactly to the prediction. Aggregating these across the dataset gives global feature importance.
How much data do I need?
At least about 30 observations. Below that, SHAP values become unstable and feature contributions unreliable, so a directly interpretable model such as a decision tree is the safer choice.
Sources
- 1.Lundberg, S.M. & Lee, S.-I. (2017). A Unified Approach to Interpreting Model Predictions. Advances in Neural Information Processing Systems, 30, 4766–4777.
You have read it. What now?
Cite this page
ScholarGate. (2026, June 1). SHAP. ScholarGate. https://scholargate.app/machine-learning/shap-analysis