SHAP — Fair Credit for Every Feature

SHAP is the most important interpretability method in practice today, because it answers "how much did each feature contribute to this prediction?" with a principled, mathematically fair answer borrowed from game theory. Where LIME gives an intuitive but unstable local explanation, SHAP gives a grounded one with guarantees — and it unifies local and global interpretability into one framework. This post explains the idea behind SHAP without the heavy math, and why it became the field's default.

Post 4 covered LIME and its lack of guarantees. This post covers the method built to fix that: SHAP (SHapley Additive exPlanations), which brings a rigorous, decades-old idea from cooperative game theory to feature attribution. It’s the technique most interpretability work now reaches for, so understanding its core idea and its trade-offs is essential.

The game-theory idea: fairly dividing credit

SHAP is built on the Shapley value, a concept from cooperative game theory that solves a seemingly unrelated problem: if a team achieves some payout together, how do you fairly attribute credit to each player? The answer Shapley derived is the unique way to split credit that satisfies a set of fairness axioms — essentially, each player’s credit is their average marginal contribution across all the ways the team could have been assembled.

SHAP maps this directly onto prediction: the “game” is making a prediction, the “players” are the features, and the “payout” is the model’s output for a given instance. The SHAP value of a feature is its fair share of credit for pushing the prediction away from a baseline (the average prediction) — computed as its average marginal contribution across all possible subsets of features. In plain terms: how much does adding this feature’s value change the prediction, averaged over all the contexts of other features?

The beauty is that this isn’t an ad-hoc heuristic like LIME’s local fit — it’s the unique attribution satisfying fairness properties: - Efficiency — the feature contributions add up exactly to the difference between this prediction and the baseline, so the explanation fully accounts for the prediction (nothing unexplained). This is the “additive” in SHAP. - Symmetry — features that contribute equally get equal credit. - Dummy — a feature that never changes the prediction gets zero credit. - Consistency — if a model changes so a feature contributes more, its SHAP value won’t decrease (the property that impurity importance violated, post 3).

These guarantees are exactly what LIME lacked (post 4), and they’re why SHAP explanations are stable (not randomly different on reruns) and theoretically trustworthy in a way LIME’s aren’t. SHAP answers “why this prediction?” with a principled, reproducible breakdown of each feature’s contribution.

What SHAP gives you — local and global unified

SHAP’s practical power is that one framework delivers both levels of interpretability (post 1):

This local-global unification, plus the fairness guarantees, is why SHAP became the de facto standard: it’s the one method that gives trustworthy, consistent explanations at both levels with excellent tooling.

The catch: cost, and what SHAP still can’t do

SHAP isn’t free, and using it well means knowing its limits:

Used with these in mind, SHAP is the best general-purpose interpretability tool available: reach for it (TreeSHAP especially) when you want stable, principled, local-and-global explanations with good tooling; accept its cost on non-tree black boxes; and never mistake its fair attribution for a causal claim. It fixed LIME’s biggest weaknesses (instability, lack of guarantees) by grounding explanation in game theory, which is why it’s the method most practitioners now default to — while remembering that even the best explanation is still a faithful description of the model, flaws and all, not the truth about the world (post 8).

The throughline: SHAP brings the game-theoretic Shapley value — the unique fair way to divide credit among cooperating players — to feature attribution: the “players” are features, the “payout” is the prediction, and a feature’s SHAP value is its average marginal contribution across all feature subsets. Unlike LIME’s ad-hoc local fit, this satisfies fairness axioms — efficiency (contributions sum exactly to prediction minus baseline — the “additive”), symmetry, dummy, consistency — giving stable, principled, reproducible explanations and fixing LIME’s biggest flaws. One framework unifies local (per-prediction additive breakdowns — the gold standard) and global (consistent aggregated importance) interpretability with rich visualizations, which is why it’s the de facto standard. The catch: exact Shapley values are exponential, so it relies on approximations (TreeSHAP fast/exact for trees — why it’s popular on tabular data; KernelSHAP slow/approximate for any model); correlated features still muddy attribution; and critically it explains the model, not the world — a SHAP value is fair attribution within the model, not a causal claim, and it faithfully explains flawed models too.

Key takeaways

Further reading

Sources & References