SHAP
Exact Shapley values are beautifully principled and brutally expensive. SHAP provides practical approximations and a common additive explanation format.
Kernel SHAP samples feature coalitions, gets a black-box prediction for each one, and fits a weighted linear model. The fitted coefficients estimate the Shapley values.
Additive explanation
SHAP writes a prediction as:
is the baseline prediction and each is a signed contribution. Positive and negative attributions reconcile exactly with the explained output under the chosen SHAP method.
Kernel SHAP — Step by Step
Walk through each stage of Kernel SHAP for a single loan applicant. The algorithm approximates Shapley values by fitting a weighted linear regression over feature coalition samples.
Step 1 — Sample Coalitions
We enumerate subsets of features — called coalitions — where each feature is either present (1) or absent (0). For 3 features there are 8 possible subsets. In practice, Kernel SHAP samples a random subset of these when the feature count is large.
Instance being explained
Progress
Reading SHAP Plots
SHAP values can be visualized in three main ways. Each plot answers a different question — use the tabs to explore them.
A force plot explains one prediction. Features push the output right (positive, red) or left (negative, blue) from a shared baseline. The final prediction is where the forces balance.
income=high
+0.18
history=good
+0.10
employed=yes
+0.10
debt=low
-0.06
Hover a feature to interpret its contribution.
Why might two correlated features each receive a smaller SHAP value than expected?