Shapley Values and SHAP Value Functions
Summary
The Shapley value of a cooperative game averages a player’s marginal contribution over all orderings of the players; it is the unique allocation of satisfying symmetry, dummy and additivity. Feature-attribution methods (SHAP, KernelSHAP, TreeSHAP, Shapley sampling values, QII, FAE) treat features as players and set , but they must also say what a subset of features is worth. There are two families: the conditional value function and the interventional one . Kumar et al.’s Table 1 shows that several methods define the conditional game but compute the interventional one (KernelSHAP), which is why they classify methods by what is estimated. This note is the vault’s owner note for the Shapley/SHAP definitions.
Overview
This note transcribes §2 (“Background”) of Kumar et al. (2020) in full: the classical definition, the axioms, the notation for features, the two value-function families and the algorithmic split summarised in Table 1. Every later critique in the paper is phrased in this notation, so the downstream notes (Kumar et al - Conditional vs Interventional Shapley Catch-22, Kumar et al - Additivity Axiom Limits for Non-Additive Models) link back here.
The basic move is old. Kruskal (1987) and Lipovetsky & Conklin (2001) used the Shapley value for global importance in linear regression, with the of a linear model built on predictors ; this decomposes explained variance additively across features. Owen & Prieur (2017) used it for sensitivity analysis, where the payoff is the total variance of a function (§2.2.1, p.2). The recent “local” methods (Ribeiro et al. 2016; Lundberg & Lee 2017; Lundberg et al. 2018) define a payoff that depends on the instance being explained.
Main Content
Classical Shapley values (§2.1, p.1-2)
Definition: Coalitional game and marginal contribution (§2.1, eq. 1, p.2)
A coalitional game has a set of players and a characteristic function mapping subsets to real values , with . is the collective payoff the players in can gain by “cooperating”. The marginal contribution of player to coalition is
Definition: Shapley value — permutation and subset forms (§2.1, eq. 2-3, p.2)
Let be the set of permutations of and, for , let be the players preceding in . The Shapley value of is
Grouping permutations by the set that precedes (each precedes in orderings):
(The paper prints the sum over ; terms with have , so the two readings agree.)
Reading: a weighted average of ‘s marginal contributions to every possible subset — equivalently, the expected marginal contribution when players join in a uniformly random order.
Theorem: Axiomatic characterization (§2.1, p.2)
is the unique allocation of the grand-coalition value satisfying:
- Symmetry: for two players , if for any subset , then .
- Dummy: for a single player , if for all subsets , then .
- Additivity: for a single player and two value functions , .
Together with the efficiency built into “allocation of ” this gives .
Caveat developed in §3.2: for any two of the three axioms there is a non-Shapley allocation satisfying them, so uniqueness rests on all three — and additivity is the contested one (see Kumar et al - Additivity Axiom Limits for Non-Additive Models).
Shapley values for feature importance (§2.2, p.2)
Given a model , the features are the players and is “some measure of the importance or influence of that subset”; is read as the influence of feature on the outcome. A method is a choice of value function plus a way to compute or approximate the resulting Shapley values.
Notation (§2.2, p.2)
Symbol Meaning the set of features a multivariate random variable a set of values the random variables the values the complement value of coalition when explaining at ;
Value functions (§2.2.1, p.2)
For local explanation, the grand-coalition value is the prediction, . The methods differ in how acts on proper subsets.
Definition: Conditional (observational) value function (§2.2.1, eq. 4, p.2)
Shapley sampling values (Štrumbelj & Kononenko 2014) and SHAP values (Lundberg & Lee 2017) are defined through the conditional expected model output when only the features in are known:
Definition: Interventional value function (§2.2.1, eq. 5, p.2)
Quantitative Input Influence (QII; Datta et al. 2016) borrows from causal inference: simulate an intervention on the features not in , breaking their correlation with the features in :
where is derived from the product of the marginal distributions of the features in . Merrick & Taly (2019) generalise the use of a distribution other than the data’s and propose the Formulate, Approximate, Explain (FAE) framework that unifies several Shapley-explanation approaches.
The distinction is between conditioning on (an observational quantity, see Spurious Association and Confounds) and setting while drawing the rest independently (an intervention in the sense of do-calculus). Which is the “right” target is argued from the causal side in Janzing et al. (2020).
Algorithms and Table 1 (§2.2.2, p.2-3)
Methods with the same stated value function can differ because of the assumptions used in approximation:
- TreeSHAP (Lundberg et al. 2018) — “an efficient algorithm for calculating SHAP values on additive tree-based models such as random forests and gradient boosting machines” (p.2). (Kumar et al. do not call it exact; it computes without Monte Carlo sampling — §3.1.1 says it estimates the conditional expectations “directly, without sampling, using information computed during model training”, p.3-4 — but the conditional distribution it uses is itself a leaf-count model of the training data, see Kumar et al - Conditional vs Interventional Shapley Catch-22.) It estimates from the proportion of training samples matching the condition that fall into each leaf, so it does not rely on feature independence.
- KernelSHAP (Lundberg & Lee 2017) — estimates the conditional expectation by assuming feature independence: samples of , , are drawn from their marginal joint distribution. This “effectively approximates an expectation over an interventional distribution instead, though in a slightly different way from QII” (p.3).
Table 1 — stated vs estimated value function (p.3)
Method Stated Actually approximated KernelSHAP, Shapley sampling values QII, FAE, Interventional TreeSHAP Conditional TreeSHAP, Frye et al. (2019), Aas et al. (2019) Caption (verbatim, p.3): “Proposed value function for each method, compared with the quantity the algorithm actually approximates. The interventional distribution used depends on the method (i.e., for KernelSHAP it is the observational joint distribution of ).”
Gloss (ours, not in the caption): the symbol printed as is ambiguous; read with the §2.2.2 text (“samples of the features in are drawn from the marginal joint distribution of these variables”), it means the observational joint distribution of , drawn independently of .
Interventional vs conditional TreeSHAP (left implicit by the source). Table 1 lists “Interventional TreeSHAP” next to QII and FAE (value function and estimate both ), and “Conditional TreeSHAP” next to Frye et al. and Aas et al. (both conditional). The paper never describes the interventional variant in the text. Its only algorithmic description of TreeSHAP (§2.2.2, p.2-3; §3.1.1, p.4) is the leaf-proportion conditional estimator, so §2.2.2 and §3.1.1 are about conditional TreeSHAP. The row-label is the paper’s only signal that an interventional variant exists. Background, not from the source: in the SHAP library, interventional TreeSHAP walks each tree with a background dataset and replaces the features not in with background values, ignoring their dependence on . That makes it an exact computation of the marginal/interventional game, the reason it is listed with QII and FAE.
Convention adopted for the rest of the paper: a method is called interventional or conditional according to its estimation method. KernelSHAP, Shapley sampling values, QII and FAE are interventional; TreeSHAP and the in-distribution samplers of Aas et al. and Frye et al. are conditional.
Generic Monte Carlo estimator of a local Shapley value (permutation sampling; Štrumbelj & Kononenko style — illustration, not in the source)
Input: model , instance , feature , background sampler for (marginal → interventional; conditional model → conditional), draws.
- For : draw a random permutation and let .
- Draw background sampler for (given if conditional).
- Form and ; record .
- Return .
The only difference between a conditional and an interventional estimator is the sampler in step 2 — which is exactly where Kumar et al.’s §3.1 catch-22 lives.
Examples
Example: Interaction credit is split evenly (illustration consistent with §2)
Setup. , independent with mean 0 (so conditional and interventional value functions coincide). Explain , .
Value function. ; ; ; .
Shapley values (eq. 3, , weights ). ; . Sum .
Interpretation. In general and : each main effect is credited to its own feature and the interaction term is divided equally, irrespective of which feature “drives” it. This even split is the seed of the multiplicative-model result in ^thm-multiplicative.
Example: Global (Shapley/LMG) decomposition (§2.2.1 historical use)
Setup. Weekly sales regressed on two media drivers over 104 weeks; , , (hypothetical numbers).
Shapley share. ; ; total .
Interpretation. This is the Kruskal / Lipovetsky-Conklin use: an additive split of explained variance among correlated predictors. It answers “how much fit is attributable”, not “what would sales do if TV spend changed” — the gap Kumar et al.’s §4.2 presses on (Kumar et al - Shapley Values as Contrastive and Actionable Explanations).
Connections
- Kumar et al - Conditional vs Interventional Shapley Catch-22 — §3.1: each value function has a failure mode.
- Kumar et al - Additivity Axiom Limits for Non-Additive Models — §3.2: what the axioms force on additive vs multiplicative models.
- Janzing et al 2020 - Feature Relevance as a Causal Problem - Overview — argues the interventional value function is the conceptually right one for explaining a model.
- Dillon et al - SHAP and Causal Insights - Overview — why SHAP of a predictive model is not a causal effect; links to DML Estimators for ATE and the Interactive Model.
- Hooker Mentch Zhou 2021 - Permute-and-Predict Extrapolation - Overview and Strobl et al 2008 - Conditional Variable Importance - Overview — the permutation-importance counterpart of the marginal-vs-conditional sampler choice.
- Fisher Rudin Dominici 2019 - Model Class Reliance - Overview — importance of a variable across all good models rather than for one fitted .
See Also
- Kumar et al 2020 - Problems with Shapley-Value Explanations - Overview — parent overview and source map.
- Counterfactual Inference — the interventional quantity the conditional game does not compute.
- Spurious Association and Confounds — why conditioning on correlated features transfers credit.