Shapley values from cooperative game theory, applied to ML: each feature gets a fair share of
the prediction. Explore local explanations for one instance, then switch to global view to see
which features matter most across the whole dataset.
Local explanation
Global explanation
Black-box model
A toy model with interpretable features so you can check the explanations intuitively.
Instance features
f(x) prediction–
E[f(x)] base value–
Σ SHAP–
––
How SHAP works
1Consider every possible coalition of features
2For each, measure the marginal contribution of feature i
3Average over all orderings (Shapley formula)
4Result: f(x) = E[f] + Σ φᵢ
φᵢ = ΣS⊆F\{i} |S|!(|F|-|S|-1)! / |F|! × [ f(S∪{i}) − f(S) ]
For each coalition S, "absent" features
are replaced with their expected value
(marginal expectation).
Waterfall — SHAP values per feature
Each bar shows one feature's Shapley value. Red = pushes prediction up; blue = pushes it down.
The bars chain from the base value to the final prediction (efficiency axiom: they must add up).
Coalition breakdown — all 2F subsets
Every possible feature coalition S, the model's output f(S), and the marginal contribution
when a selected feature joins. This is the raw data the Shapley formula averages over.
Click a feature name in the waterfall chart to highlight its contributions here.
Global feature importance — mean |SHAP|
Average absolute SHAP value across many random instances. Higher = more influential overall.
Beeswarm — SHAP distribution per feature
Each dot is one instance. Horizontal position = SHAP value (left = pushes down, right = pushes up).
Color = feature value (blue = low, red = high). Reveals the direction and spread of each feature's effect.