LIME — short for Local Interpretable Model-agnostic Explanations — has a local line with a slope, but splitting a single prediction's credit fairly among several features isn't the same problem — especially when two features are worth far more together than either is alone. Shapley values, borrowed whole from 1950s game theory, are the one way to do that split that's provably fair.
A pizza's quality score, built from three upgrades: fresh dough, extra cheese, toppings. Cheese and toppings together are worth much more than their solo effects added up — a real synergy. The bars are each feature's Shapley value: the one splitting of the total credit that accounts for that synergy fairly.
Add features to an empty pizza in some order, and each one's marginal contribution is how much the score jumps when it joins:
- — one possible order in which features could arrive.
- — the feature whose contribution is being measured.
- — the value function: the score achieved by a coalition (subset of features) .
- — how much the score jumps when feature joins, given the features already present ahead of it in order .
A feature's Shapley value is that marginal contribution, averaged over every possible order features could arrive in:
- — feature 's Shapley value: its marginal contribution, averaged over every possible arrival order.
- — the total number of features being split credit among.
- Averaging over every order is what makes this fair
A feature that only pays off in combination with another gets credit for that exactly as often as the ordering happens to reward it, rather than however an arbitrarily chosen single order would credit it.
Step through all six arrival orders. Extra cheese's marginal contribution swings from as little as (arriving first, alone) to as much as (arriving after toppings, where the synergy kicks in) — the same feature, wildly different credit, depending only on who got there first. The Shapley value is the one number that averages all six of those swings into a single fair answer.
Baseline (no upgrades) scores ; the full pizza scores — a gap of to split three ways:
- Order matters for any one feature
- In the order dough → cheese → toppings, cheese joins a pizza that already has dough: .
- In the order toppings → cheese → dough, cheese joins a pizza that already has toppings: .
Same feature, same final pizza, different credit, because cheese's payoff depends on what's already there.
- Average over all 6 orders
Each feature's marginal contribution across all 6 orderings:
- Fresh dough: — summing to , so
- Extra cheese: — summing to , so
- Toppings: by the same process, also summing to , so
Extra cheese and toppings tie, even though their solo effects ( and ) weren't, because they share the same synergy with each other in every ordering that puts them together.
- The credits add up exactly
— precisely the gap between the baseline and the full pizza. This isn't a coincidence: it's the efficiency property built into Shapley values by construction.
Pick the feature with the lowest Shapley value.
Shapley values are the unique way to split credit that satisfies a short list of fairness axioms — efficiency (credits sum to the total), symmetry (identical features get identical credit), and a couple of others game theorists proved decades before anyone applied this to machine learning. The catch is cost: with features there are orderings to average over, which is fine for three features and impossible for three hundred. The next chapter is about making this practical for a real, trained model.