Shapley value
Shapley value
In cooperative-game-theory, the Shapley value is a method (solution-concept) for fairly distributing the total gains or costs among a group of players who have collaborated. For example, in a team project where each member contributed differently, the Shapley value provides a way to determine how much credit or blame each member deserves. It was named in honor of lloyd-shapley, who introduced it in 1951.
The Shapley value determines each player's contribution by considering how much the overall outcome changes when they join each possible combination of other players, and then averaging those changes. In essence, it calculates each player's average marginal contribution across all possible coalitions. It is the only solution that satisfies four fundamental properties: efficiency, symmetry, additivity, and the dummy player (or null player) property, the amount that player <math>i</math> is given in a coalitional game <math>(v, N) </math> is
:<math>\varphi_i(v)=\sum_{S \subseteq N \setminus \{i\}} \frac^{-1} (v(S\cup\{i\})-v(S)) </math>
where <math>n</math> is the total number of players and the sum extends over all subsets <math>S</math> of <math>N</math> not containing player <math>i</math>, including the empty set. Also note that <math>{n \choose k}</math> is the binomial coefficient. The formula can be interpreted as follows: imagine the coalition is formed one actor at a time, with each actor demanding their contribution <math>v(S\cup \{ i \} ) - v(S)</math> as a fair compensation, and then for each actor take the average of this contribution over the possible different permutations in which the coalition can be formed.
An alternative, equivalent formula for the Shapley value is:
:<math>\varphi_i(v)= \frac{1}{n!}\sum_R\left [ v(P_i^R \cup \left \{ i \right \}) - v(P_i^R) \right ]</math>
where the sum ranges over all <math>n!</math> orders <math>R</math> of the players and <math>P_i^R</math> is the set of players in <math>N</math> which precede <math>i</math> in the order <math>R</math>.
In terms of synergy
From the characteristic function <math>v</math> one can compute the synergy (Harsanyi dividend) that each group of players provides. The synergy is the unique function <math> w \colon 2^N \to \mathbb{R} </math>, such that
: <math>v(S) = \sum_{R \subseteq S } w(R) </math>
for any subset <math>S \subseteq N </math> of players. In other words, the 'total value' of the coalition <math>S</math> comes from summing up the synergies of each possible subset of <math>S</math>.
Given a characteristic function <math>v</math>, the synergy function <math>w</math> is calculated via
: <math>w(S) = \sum_{R \subseteq S } (-1)^ v(R) </math>
using the Inclusion exclusion principle. In other words, the synergy of coalition <math>S</math> is the value <math>v(S)</math> , which is not already accounted for by its subsets.
The Shapley values are given in terms of the synergy function by
: <math>\varphi_i(v) = \sum_{i \in S \subseteq N } \frac{w(S)} </math>
where the sum is over all subsets <math>S</math> of <math>N</math> that include player <math>i</math>.
This can be interpreted as
: <math>\varphi_i(v) = \sum_{\text{coalitions including i}} \frac{\text{synergy of the coalition}}{\text{number of members in the coalition}} </math>
In other words, the synergy of each coalition is divided equally between all members.
This can be interpreted visually with a Venn diagram. In the first example diagram above, each region has been labeled with the synergy bonus of the corresponding coalition. The total value produced by a coalition is the sum of synergy bonuses of the composing subcoalitions - in the example, the coalition of the players labeled "You" and "Emma" would produce a profit of <math> 30+20+40=90 </math> dollars, as compared to their individual profits of <math> 30 </math> and <math> 20 </math> dollars respectively. The synergies are then split equally among each member of the subcoalition that contributes that synergy - as displayed in the second diagram.
Examples ### Business example Consider a simplified description of a business. An owner, o, provides crucial capital in the sense that, without him/her, no gains can be obtained. There are m workers w1,...,wm, each of whom contributes an amount p to the total profit. Let
:<math>N = \{o, w_1,\ldots,w_m\}.</math>
The value function for this coalitional game is :<math> v(S) = \begin{cases} (|S|-1)p & \text{if }o \in S\;,\\ 0 & \text{otherwise}\;.\\ \end{cases} </math> Computing the Shapley value for this coalition game leads to a value of for the owner and for each one of the m workers.
This can be understood from the perspective of synergy. The synergy function <math>w</math> is :<math> w(S) = \begin{cases} p, & \text{if } S = \{ o, w_i \} \\ 0, & \text{otherwise}\\ \end{cases} </math>
so the only coalitions that generate synergy are one-to-one between the owner and any individual worker.
Using the above formula for the Shapley value in terms of <math>w</math> we compute
: <math>\varphi_{w_i} = \frac{w(\{o, w_i \})}{2} = \frac{p }{2} </math> and : <math>\varphi_o = \sum_{i=1}^m \frac{w(\{o, w_i \})}{2} = \frac{m p }{2} </math>
The result can also be understood from the perspective of averaging over all orders. A given worker joins the coalition after the owner (and therefore contributes p) in half of the orders and thus makes an average contribution of <math>\frac p2</math> upon joining. When the owner joins, on average half the workers have already joined, so the owner's average contribution upon joining is <math>\frac{mp}2</math>.
Glove game The glove game is a coalitional game where the players have left- and right-hand gloves and the goal is to form pairs. Let :<math>N = \{1, 2, 3\},</math> where players 1 and 2 have right-hand gloves and player 3 has a left-hand glove.
The value function for this coalitional game is :<math> v(S) = \begin{cases} 1 & \text{if }S \in \left\{ \{1,3\},\{2,3\},\{1,2,3\} \right\};\\ 0 & \text{otherwise}.\\ \end{cases} </math>
The formula for calculating the Shapley value is
:<math>\varphi_i(v)= \frac{1} \text{Order }R\,\! & MC_1 \\ \hline {1,2,3} &v(\{1\}) - v(\varnothing) = 0 - 0 = 0 \\ {1,3,2} &v(\{1\}) - v(\varnothing) = 0 - 0 = 0 \\ {2,1,3} &v(\{1,2\}) - v(\{2\}) = 0 - 0 = 0 \\ {2,3,1} &v(\{1,2,3\}) - v(\{2,3\}) = 1 - 1 = 0 \\ {3,1,2} &v(\{1,3\}) - v(\{3\}) = 1 - 0 =1 \\ {3,2,1} &v(\{1,3,2\}) - v(\{3,2\}) = 1 - 1 = 0 \end{array} </math>
Observe :<math>\varphi_1(v)= \!\left(\frac{1}{6}\right)(1)=\frac{1}{6}.</math>
By a symmetry argument it can be shown that :<math>\varphi_2(v)=\varphi_1(v)=\frac{1}{6}.</math>
Due to the efficiency axiom, the sum of all the Shapley values is equal to 1, which means that
:<math>\varphi_3(v) = \frac{4}{6} = \frac{2}{3}.</math>
Properties The Shapley value has many desirable properties. Notably, it is the only payment rule satisfying the four properties of Efficiency, Symmetry, Linearity and Null player (or dummy player). See
Anonymity If <math>i</math> and <math>j</math> are two agents, and <math>w</math> is a gain function that is identical to <math>v</math> except that the roles of <math>i</math> and <math>j</math> have been exchanged, then <math>\varphi_i(v) = \varphi_j(w)</math>. This means that the labeling of the agents doesn't play a role in the assignment of their gains.
Marginalism The Shapley value can be defined as a function which uses only the marginal contributions of player <math>i</math> as the arguments.
Aumann–Shapley value In their 1974 book, lloyd-shapley and robert-aumann extended the concept of the Shapley value to infinite games (defined with respect to a non-atomic measure), creating the diagonal formula. This was later extended by jean-françois-mertens and abraham-neyman.
As seen above, the value of an n-person game associates with each player the expectation of their contribution to the worth of the coalition of players before them in a random ordering of all the players. When there are many players and each individual plays only a minor role, the set of all players preceding a given one is heuristically thought of as a good sample of all players. The value of a given infinitesimal player is then defined as "their" contribution to the worth of a "perfect" sample of all the players.
Symbolically, if is the coalitional worth function that associates each coalition with its value, and each coalition is a measurable subset of the measurable set of all players, that we assume to be <math>I=[0,1]</math> without loss of generality, the value <math>(Sv)(ds)</math> of an infinitesimal player in the game is
: <math> (Sv)(ds) = \int_0^1 (\, v(tI + ds)- v(tI)\,)\,dt. </math>
Here is a perfect sample of the all-player set containing a proportion of all the players, and <math>tI+ ds</math> is the coalition obtained after joins . This is the heuristic form of the diagonal formula.
: <math> (Sv)(ds) = \lim_{\varepsilon \to 0, \varepsilon>0} \frac{1}{\varepsilon}\int_0^{1-\varepsilon} (f(t+\varepsilon \mu(ds))-f(t)) \, dt </math>
This works for example for majority games—while the original diagonal formula cannot be used directly. How Mertens further extends this by identifying symmetries that the Shapley value should be invariant upon, and averaging over such symmetries to create further smoothing effect commuting averages with the derivative operation as above. A survey for non atomic value is found in Neyman (2002)
Generalization to coalitions The Shapley value only assigns values to the individual agents. It has been generalized to apply to a group of agents C as,
: <math> \varphi_C(v) = \sum_{T \subseteq N \setminus C} \frac{(n - |T| - |C|)! \; |T|!}{(n - |C| + 1)!} \sum_{S \subseteq C} (-1)^ v( S \cup T ) \; . </math>
In terms of the synergy function <math>w</math> above, this reads into a matrix of values
: <math> \varphi_{ij}(v) = \sum_{S \subseteq N} \frac{(|S| - 1)! \; (n - |S|)!}{n!} (v(S) - v(S \setminus \{i\}) - v(S \setminus \{j\}) + v(S \setminus \{i, j\})) \sum_{t=|S|}^n \frac{1}{t} </math>
Each value <math>\varphi_{ij}(v) </math> represents the value of player <math>i</math> to player <math>j</math>. This matrix satisfies
: <math> \varphi_i(v) = \sum_{j \in N} \varphi_{ij}(v) </math>
i.e. the value of player <math>i</math> to the whole game is the sum of their value to all individual players.
In terms of the synergy <math>w</math> defined above, this reads
: <math> \varphi_{ij}(v) = \sum_{\{i, j\} \subseteq S \subseteq N} \frac{w(S)}{|S|^2} </math>
where the sum goes over all subsets <math>S</math> of <math>N</math> that contain <math>i</math> and <math>j</math>.
This can be interpreted as sum over all subsets that contain players <math>i</math> and <math>j</math>, where for each subset <math>S</math> you take the synergy <math>w(S)</math> of that subset divide it by the number of players in the subset <math>|S|</math>. Interpret that as the surplus value player <math>i</math> gains from this coalition * further divide this by <math>|S|</math> to get the part of player <math>i</math>'s value that's attributed to player <math>j</math>
In other words, the synergy value of each coalition is evenly divided among all <math>|S|^2</math> <em>pairs</em> <math>(i, j)</math> of players in that coalition, where <math>i</math> generates surplus for <math>j</math>.
Shapley value regression Shapley value regression is a statistical method used to measure the contribution of individual predictors in a regression model. In this context, the "players" are the individual predictors or variables in the model, and the "gain" is the total explained variance or predictive power of the model. This method ensures a fair distribution of the total gain among the predictors, attributing each predictor a value representing its contribution to the model's performance. Lipovetsky (2006) discussed the use of Shapley value in regression analysis, providing a comprehensive overview of its theoretical underpinnings and practical applications.
Shapley value contributions are recognized for their balance of stability and discriminating power, which make them suitable for accurately measuring the importance of service attributes in market research. Several studies have applied Shapley value regression to key drivers analysis in marketing research. Pokryshevskaya and Antipov (2012) utilized this method to analyze online customers' repeat purchase intentions, demonstrating its effectiveness in understanding consumer behavior. Similarly, Antipov and Pokryshevskaya (2014) applied Shapley value regression to explain differences in recommendation rates for hotels in south Cyprus, highlighting its utility in the hospitality industry. Further validation of the benefits of Shapley value in key-driver analysis is provided by Vriens, Vidden, and Bosch (2021), who underscored its advantages in applied marketing analytics.
In machine learning The Shapley value provides a principled way to explain the predictions of nonlinear models common in the field of machine learning. By interpreting a model trained on a set of features as a value function on a coalition of players, Shapley values provide a natural way to compute which features contribute to a prediction or contribute to the uncertainty of a prediction. This unifies several other methods, including locally interpretable model-agnostic explanations (LIME), DeepLIFT, and layer-wise relevance propagation.
Distributional values are an extension of the Shapley value and related value operators designed to preserve the probabilistic output of predictive models in machine learning, including neural network classifiers and large language models.
The statistical understanding of Shapley values remains an ongoing research question. A smooth version, called Shapley curves, achieves the minimax rate and is shown to be asymptotically Gaussian in a nonparametric setting. Confidence intervals for finite samples can be obtained via the wild bootstrap.