Introduction
Ensemble methods, which combine the predictions of multiple base classifiers through a voting mechanism, are widely used in modern machine learning, as they achieve higher accuracy and robustness than individual models [37 , 49 ] . Among the variety of aggregation rules [33 ] , plurality voting —where the prediction corresponds to the most voted class, with ties broken uniformly at random—is a well-established scheme that applies directly to binary and multiclass classification and is used by many ensembles and popular software packages [24 , 49 ] .
Attribution is a central question for an ensemble, that is, quantifying how much each base classifier contributes to the ensemble’s predictions. Simple heuristics, such as leave-one-out accuracy or per-model performance, ignore the interactions among base models: such heuristics measure the contribution of a base classifier to a single sub-ensemble, i.e., the full or empty one, respectively, among the Θ ( 2 n ) \Theta(2^n) Θ ( 2 n ) sub-ensembles (where n n n corresponds to the number of base classifiers). For example, a single vote of a base classifier can modify the prediction of any sub-ensemble with a tie for the most voted class. Cooperative game theory addresses precisely this problem through power indices , in particular the Banzhaf value [3 ] and the Shapley value [38 ] , uniquely characterized by natural axioms, faithfully capture the contribution of a player to the outcome of the game.
Computing power indices is intractable in general, involving a summation over an exponential number of coalitions, which we also refer to as sub-ensembles. Prior work has therefore reported
Extended version of a paper accepted at NeurIPS 2026. either to approximations [2 , 36 ] or to restricted game classes, most prominently weighted majority games (WMGs) [42 , 46 ] . However, these approaches do not capture plurality voting with random tie-breaking and cannot easily be applied to multiclass settings.
We first introduce a new game capturing plurality-voting ensembles with random tie-breaking. We then design ENPOWER, a collection of algorithms computing the exact Banzhaf and Shapley power indices of every base classifier in our game, for binary and multiclass classification. We consider base classifiers casting hard votes. Since our analysis considers only the votes of the base classifiers, our results are agnostic to the underlying models and apply to heterogeneous ensembles. The power indices we obtain can be used for many important applications such, ensemble pruning [19 ] , data validation, and feature selection [16 ] . We first address the binary case, which differently from a WMG is not a simple game (i.e., a monotone game with values in { 0 , 1 } \{0,1\} { 0 , 1 } ) due to random tie-breaking. We obtain closed-forms for both power indices, computable in time O ( ∣ D ∣ n ) O(|\mathcal{D}|n) O ( ∣ D ∣ n ) , where ∣ D ∣ |\mathcal{D}| ∣ D ∣ is the number of test points. We then provide a new algorithmic contribution for the multiclass case with ℓ \ell ℓ classes, where existing games do not capture faithfully ensemble aggregation. We show how to compute exactly the Banzhaf values in time O ( ∣ D ∣ n ℓ 2 ) O(|\mathcal{D}|n\ell^2) O ( ∣ D ∣ n ℓ 2 ) and the Shapley values in time O ( ∣ D ∣ n 3 ℓ ) O(|\mathcal{D}|n^3\ell) O ( ∣ D ∣ n 3 ℓ ) , that is, polynomial in n n n and ℓ \ell ℓ . We consider unweighted votes; extending ENPOWER to weighted plurality voting is non-trivial.
Our technical results exploit structural symmetries : base classifiers with identical votes yield the same contributions to the ensemble. In the binary case, this yields closed-form solutions for both power indices. In the multiclass case, we encode coalition counts via ordinary generating functions [13 ] with low degree, computed efficiently with dynamic programming. Our techniques build on previous methods using ordinary generating functions to compute power indices in WMGs [4 ] . We also discuss a variant of our dynamic programming approach for the Shapley values using fast polynomial multiplication, with a faster asymptotic time bound.
In our experimental evaluation we use the Banzhaf and Shapley values computed with ENPOWER on two applications: ensemble pruning [18 , 25 ] , and prompt-based ensembling of vision-language models [35 ] , on a zero-shot image classification task. Our empirical study shows that ENPOWER is highly efficient in practice computing exact power indices in a few seconds on most instances, and produces attribution values that are not captured by existing methods, directly characterizing plurality-voting ensembles with random tie-breaking.
Related work
Ensembles combine predictions of base models using a voting mechanism [37 ] . Prior work has considered learning algorithms to obtain homogeneous or heterogeneous base models, e.g., through boosting, bagging, or stacking [33 ] , and different aggregation rules to combine predictions of base models. Widely-adopted rules include averaging, majority voting, and plurality voting [49 ] , which is the focus of our work.
Attribution is a key challenge in explainable AI [30 ] and power indices have been used extensively to assign values to individual models or features [26 , 40 , 44 ] . To the best of our knowledge, our work is the first to consider the attribution problem in plurality-voting ensembles with random tie-breaking, for both binary and multiclass settings.
Earlier work has mostly focused on computing power indices for ensembles under binary classification, building on results from classical cooperative game theory [7 , 10 ] and weighted majority games (WMGs) [12 , 14 , 15 ] . Under unitary weights, power indices for WMGs can be computed in polynomial time [42 ] , while recent contributions use techniques similar to ours [17 ] . However, as we discuss in Sec. A, WMGs cannot be used effectively in our setting.
Close to our work, Rozemberczki and Sarkar Rozemberczki and Sarkar [36 ] study a game for ensembles of soft binary classifiers aggregated through a majority rule . They design an approximation algorithm using multilinear extensions to estimate Shapley values. Ykhlef and Bouchaffra Ykhlef and Bouchaffra [47 ] use a classical result by Deng and Papadimitriou Deng and Papadimitriou [10 ] to model ensemble diversity through Shapley values, capturing, however, only pairwise relationships among base models and not matching the ensemble’s aggregation rule. Ykhlef and Bouchaffra Ykhlef and Bouchaffra [46 ] apply their diversity scoring to Banzhaf values computed over WMGs. In § 5 we show that our exact methods are much faster than prior work [42 , 47 ] , and are comparable with the fastest approximate method by Rozemberczki and Sarkar Rozemberczki and Sarkar [36 ] . Moreover, our algorithms yield new values not captured by existing methods. Our methods are specifically designed for multiclass settings, where prior work cannot be adapted; see Sec. A for details on additional related work.
Preliminaries
Let C = { C 1 , … , C n } \mathcal{C} = \{C_1, \ldots, C_n\} C = { C 1 , … , C n } be an ensemble of n n n classifiers, where each classifier C ∈ C C \in\mathcal{C} C ∈ C corresponds to a function C : X → Y C : \mathcal{X} \to\mathcal{Y} C : X → Y from a domain X \mathcal{X} X to a target label set Y = { y 1 , … , y ℓ } \mathcal{Y} = \{y_1, \ldots, y_\ell\} Y = { y 1 , … , y ℓ } . We use C ( x ) ∈ Y C(x) \in\mathcal{Y} C ( x ) ∈ Y to denote the class assigned by C C C to data point x ∈ X x \in\mathcal{X} x ∈ X . We do not assume that classifiers come from the same model family, neither we require access to training data.
Our goal is to characterize the contribution of each classifier C ∈ C C \in\mathcal{C} C ∈ C . Inspired by attribution methods in machine learning [16 , 26 , 41 ] , we employ ideas from cooperative game theory .
Definition 3.1 ([7 ] ). A characteristic function game (or simply game ) G G G is given by a pair ( N , v ) (N, v) ( N , v ) where N = [ n ] N = [n] N = [ n ] is a finite non-empty set of players, and v : 2 N → R v : 2^N \to\mathbb{R} v : 2 N → R is a characteristic function mapping each coalition S ⊆ N S \subseteq N S ⊆ N to a value v ( S ) v(S) v ( S ) .
Power indices are used to capture the contribution of players in games by considering changes in the value of coalitions that the players participate. Two of the most popular indices, widely adopted in the literature and considered in this paper, are the Banzhaf and Shapley values, defined below.
Definition 3.2. Given a game G = ( N , v ) G = (N, v) G = ( N , v ) the Banzhaf value β i ( G ) \beta_i(G) β i ( G ) (or simply β i \beta_i β i when the game G G G is clear) of player i ∈ N i \in N i ∈ N and the Shapley value ϕ i ( G ) \phi_i(G) ϕ i ( G ) (or simply ϕ i \phi_i ϕ i ) are defined respectively as,2
β i = 1 2 n − 1 ∑ i ∈ S ⊆ N ( v ( S ) − v ( S − i ) ) , ϕ i = ∑ i ∈ S ⊆ N ( n − ∣ S ∣ ) ! ( ∣ S ∣ − 1 ) ! n ! ( v ( S ) − v ( S − i ) ) . (1) \beta_i = \frac{1}{2^{n-1}} \sum_{i \in S \subseteq N} \left(v(S) - v(S - i)\right), \qquad\phi_i = \sum_{i \in S \subseteq N} \frac{(n - |S|)!(|S| - 1)!}{n!} \left(v(S) - v(S - i)\right). \tag*{(1)} β i = 2 n − 1 1 i ∈ S ⊆ N ∑ ( v ( S ) − v ( S − i ) ) , ϕ i = i ∈ S ⊆ N ∑ n ! ( n − ∣ S ∣ )! ( ∣ S ∣ − 1 )! ( v ( S ) − v ( S − i ) ) . (1)
The Shapley values are the unique values that satisfy the following desirable properties: dummy player, symmetry, linearity, and efficiency (see Sec. B.1). The Banzhaf values satisfy all the above properties except efficiency. While Shapley values are the natural choice when the values must sum to v ( N ) v(N) v ( N ) , the Banzhaf values are more robust to noise and easier to estimate, making them preferable in stochastic or large-scale regimes [44 ] .
Next, we define the characteristic function v v v for our setting. Given a data point x ∈ X x \in\mathcal{X} x ∈ X and a coalition S ⊆ C S \subseteq\mathcal{C} S ⊆ C , we let p ( x , S ) ∈ Z ℓ p(x, S) \in\mathbb{Z}^{\ell} p ( x , S ) ∈ Z ℓ be a vote profile , where the j j j -th component corresponds to the number of classifiers from S S S voting for y j y_j y j . We simplify p ( x , S ) p(x, S) p ( x , S ) to p ( S ) p(S) p ( S ) or p p p when x , S x, S x , S are clear from the context. We define the majority set of labels M ( x , S ) = { y j ∈ Y : p j ≥ p i , i ∈ [ ℓ ] } \mathcal{M}(x, S) = \{y_j \in\mathcal{Y} : p_j \ge p_i, i \in[\ell]\} M ( x , S ) = { y j ∈ Y : p j ≥ p i , i ∈ [ ℓ ]} , containing the labels receiving the most votes from the classifiers in the coalition S ⊆ C S \subseteq\mathcal{C} S ⊆ C .
We now introduce characteristic function games that model how plurality voting ensembles with random tie-breaking are used in practice for (1) binary classification ; and (2) multiclass classification .
Binary classification. For a data point z = ( x , y ) ∈ X × Y z = (x, y) \in\mathcal{X} \times\mathcal{Y} z = ( x , y ) ∈ X × Y , with Y = { 0 , 1 } \mathcal{Y} = \{0, 1\} Y = { 0 , 1 } , and a coalition S ⊆ C S \subseteq\mathcal{C} S ⊆ C , S ≠ ∅ S \ne\varnothing S = ∅ , we consider the point-wise characteristic function game G z = ( C , v B ) G_z = (\mathcal{C}, v_B) G z = ( C , v B ) with
v B ( z , S ) = { 1 , if { y } = M ( S ) , 1 2 , if y ∈ M ( S ) and ∣ M ( S ) ∣ = 2 , 0 , otherwise. (2) v_B(z, S) =
\begin{cases}
1, & \text{if } \{y\} = \mathcal{M}(S), \\
\frac{1}{2}, & \text{if } y \in\mathcal{M}(S) \text{ and } |\mathcal{M}(S)| = 2, \\
0, & \text{otherwise.}
\end{cases} \tag*{(2)} v B ( z , S ) = ⎩ ⎨ ⎧ 1 , 2 1 , 0 , if { y } = M ( S ) , if y ∈ M ( S ) and ∣ M ( S ) ∣ = 2 , otherwise. (2)
We let v B ( z , ∅ ) = 0 v_B(z, \varnothing) = 0 v B ( z , ∅ ) = 0 for technical purposes. In other words, for a data point z = ( x , y ) z = (x, y) z = ( x , y ) , the function v B v_B v B assigns a score to each coalition S ⊆ C S \subseteq\mathcal{C} S ⊆ C , which is: 1 if the majority of models in S S S correctly identify label y y y ; 1/2 if there is a tie; and 0 if the majority of models in S S S make an incorrect prediction.
The game G z G_z G z is defined for a single data point z z z . For a test set D \mathcal{D} D , we define the game G D G_{\mathcal{D}} G D by averaging the point-wise values v B ( z , S ) v_B(z, S) v B ( z , S ) , z ∈ D z \in\mathcal{D} z ∈ D , i.e., v B ( D , S ) = 1 ∣ D ∣ ∑ ( x , y ) ∈ D v B ( z , S ) v_B(\mathcal{D}, S) = \frac{1}{|\mathcal{D}|} \sum_{(x,y) \in\mathcal{D}} v_B(z, S) v B ( D , S ) = ∣ D ∣ 1 ∑ ( x , y ) ∈ D v B ( z , S ) . The Banzhaf and Shapley values satisfy linearity and an efficient computation of the values for v B ( z , S ) v_B(z, S) v B ( z , S ) implies efficient computation for the values for v B ( D , S ) v_B(\mathcal{D}, S) v B ( D , S ) . Thus, we focus on computing the Banzhaf and Shapley values of G z G_z G z for a single point z z z . We drop the first argument of v B v_B v B , when clear from the context. It can be shown that v B v_B v B does not feature standard properties enabling efficient computation.
Lemma 3.3. The characteristic function v B ( z , ⋅ ) : 2 C → { 0 , 1 2 , 1 } v_B(z, \cdot) : 2^\mathcal{C} \to\{0, \frac{1}{2}, 1\} v B ( z , ⋅ ) : 2 C → { 0 , 2 1 , 1 } is neither supermodular , nor super-additive , nor monotone .
All proofs can be found in Sec. C. Since v B ( z , ⋅ ) v_{\mathrm{B}}(z,\cdot) v B ( z , ⋅ ) is not monotone and it can be 1 2 \frac{1}{2} 2 1 , our game is not a simple game (i.e., a monotone game with values in { 0 , 1 } \{0,1\} { 0 , 1 } ), in particular not a WMG (see Def. B.6 ). Therefore, we cannot use existing standard algorithms to compute the power indices for our formulation. From the previous lemma, one may think that exact computation of power indices for our new game is intractable. Surprisingly, we can show that both the Banzhaf and Shapley values can be computed efficiently, see § 4.1 .
Theorem 3.4. Let C \mathcal{C} C be an ensemble of classifiers, D \mathcal{D} D a test dataset, and G D = ( C , v B ( D , ⋅ ) ) G_{\mathcal{D}}=(\mathcal{C},v_{\mathrm{B}}(\mathcal{D},\cdot)) G D = ( C , v B ( D , ⋅ )) the characteristic function game over D \mathcal{D} D . For all classifiers C i ∈ C C_i\in\mathcal{C} C i ∈ C the Banzhaf values β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) and the Shapley values ϕ i ( G D ) \phi_i(G_{\mathcal{D}}) ϕ i ( G D ) can be computed in linear-time complexity O ( ∣ D ∣ n ) O(|\mathcal{D}|n) O ( ∣ D ∣ n ) .
The term ∣ D ∣ |\mathcal{D}| ∣ D ∣ in the running time comes from averaging β i ( G z ) \beta_i(G_z) β i ( G z ) and ϕ i ( G z ) \phi_i(G_z) ϕ i ( G z ) over all z ∈ D z\in\mathcal{D} z ∈ D to compute β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) and ϕ i ( G D ) \phi_i(G_{\mathcal{D}}) ϕ i ( G D ) . The linear term O ( n ) O(n) O ( n ) is the time needed to compute β i ( G z ) \beta_i(G_z) β i ( G z ) and ϕ i ( G z ) \phi_i(G_z) ϕ i ( G z ) .
Multiclass classification. We consider a set of labels Y = { y 1 , … , y ℓ } \mathcal{Y}=\{y_1,\ldots,y_\ell\} Y = { y 1 , … , y ℓ } with ℓ > 2 \ell>2 ℓ > 2 . For a single data point z = ( x , y ) z=(x,y) z = ( x , y ) , we define the game G z = ( C , v M C ) G_z=(\mathcal{C},v_{\mathrm{MC}}) G z = ( C , v MC ) where v M C ( z , ∅ ) ≔ 0 v_{\mathrm{MC}}(z,\varnothing)\coloneqq0 v MC ( z , ∅ ) : = 0 and for S ⊆ C S\subseteq\mathcal{C} S ⊆ C , S ≠ ∅ S\ne\varnothing S = ∅ it is
v M C ( z , S ) ≔ { 1 ∣ M ( S ) ∣ , if y ∈ M ( S ) , and 0 , otherwise. (3) v_{\mathrm{MC}}(z,S)\coloneqq
\begin{cases}
\frac{1}{|\mathcal{M}(S)|}, & \text{if } y\in\mathcal{M}(S),\text{ and}\\
0, & \text{otherwise.}
\end{cases} \tag*{(3)} v MC ( z , S ) : = { ∣ M ( S ) ∣ 1 , 0 , if y ∈ M ( S ) , and otherwise. (3)
We then define the characteristic function for dataset D \mathcal{D} D by v M C ( D , S ) = 1 ∣ D ∣ ∑ ( x , y ) ∈ D v M C ( z , S ) v_{\mathrm{MC}}(\mathcal{D},S)=\frac{1}{|\mathcal{D}|}\sum_{(x,y)\in\mathcal{D}}v_{\mathrm{MC}}(z,S) v MC ( D , S ) = ∣ D ∣ 1 ∑ ( x , y ) ∈ D v MC ( z , S ) . Clearly, the characteristic function v M C v_{\mathrm{MC}} v MC generalizes v B v_{\mathrm{B}} v B from Eq. (2) .
To state our result in the multiclass case we need one additional definition. First, without loss of generality (simply by permuting the class labels), we will assume that for any data point ( x , y ) (x,y) ( x , y ) it holds y = y 1 ∈ Y y=y_1\in\mathcal{Y} y = y 1 ∈ Y . We let n j n_j n j be the number of classifiers predicting class y j y_j y j , j ∈ [ ℓ ] j\in[\ell] j ∈ [ ℓ ] for data point ( x , y ) (x,y) ( x , y ) . Finally, let U = { p ( x , C ) = ( n 1 , n 2 , … , n ℓ ) : ( x , y ) ∈ D and n 2 ≤ ⋯ ≤ n ℓ } \mathcal{U}=\{p(x,\mathcal{C})=(n_1,n_2,\ldots,n_\ell):(x,y)\in\mathcal{D}\text{ and }n_2\leq\cdots\leq n_\ell\} U = { p ( x , C ) = ( n 1 , n 2 , … , n ℓ ) : ( x , y ) ∈ D and n 2 ≤ ⋯ ≤ n ℓ } be the set of unique vote profiles, where n 1 n_1 n 1 is the number of correct classifiers. Clearly, ∣ U ∣ ≤ ∣ D ∣ |\mathcal{U}|\leq|\mathcal{D}| ∣ U ∣ ≤ ∣ D ∣ ; moreover, ∣ U ∣ ≤ n + 1 |\mathcal{U}|\leq n+1 ∣ U ∣ ≤ n + 1 for binary classification, since a profile is determined by n 1 n_1 n 1 . In practice, ∣ U ∣ |\mathcal{U}| ∣ U ∣ can be much smaller than ∣ D ∣ |\mathcal{D}| ∣ D ∣ also in the multiclass case: when most classifiers are accurate, many points share their vote profile (see ∣ U ∣ |\mathcal{U}| ∣ U ∣ in Table 2 ). We now state the generalization of Theorem 3.4 in the multiclass case.
Table 2 : Dataset statistics for the zero-shot multiclass classification experiment. For each dataset we display its total number of images, and the number of possible classes. We also show ∣ D v a l ∣ |D_{\mathrm{val}}| ∣ D val ∣ , used to compute the ranking metrics, and ∣ D t e s t ∣ |D_{\mathrm{test}}| ∣ D test ∣ used to evaluate the generalization of model selection. Column ∣ U ∣ |U| ∣ U ∣ reports the number of unique vote profiles observed on D v a l D_{\mathrm{val}} D val (the ensemble has n = 22 n = 22 n = 22 base predictors), averaged over five splits. Other columns do not depend on the split.
Table 2.
Theorem 3.5. Let C \mathcal{C} C be an ensemble of classifiers, D \mathcal{D} D be a test dataset, and G D = ( C , v M C ( D , ⋅ ) ) G_{\mathcal{D}}=(\mathcal{C},v_{\mathrm{MC}}(\mathcal{D},\cdot)) G D = ( C , v MC ( D , ⋅ )) be the characteristic function game over D \mathcal{D} D . For all classifiers i ∈ [ n ] i\in[n] i ∈ [ n ] the Banzhaf values β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) can be computed exactly in time O ( ∣ U ∣ n ℓ 2 + ∣ D ∣ n ) O(|\mathcal{U}|n\ell^2+|\mathcal{D}|n) O ( ∣ U ∣ n ℓ 2 + ∣ D ∣ n ) , and the Shapley values ϕ i ( G D ) \phi_i(G_{\mathcal{D}}) ϕ i ( G D ) can be computed exactly in time O ( ∣ U ∣ n 3 ℓ + ∣ D ∣ n ) O(|\mathcal{U}|n^3\ell+|\mathcal{D}|n) O ( ∣ U ∣ n 3 ℓ + ∣ D ∣ n ) .
Methods
We present our polynomial-time algorithms for exact computation of Banzhaf and Shapley values. All missing proofs are reported in Sec. C.
Binary classification
Intuition. As explained in the previous section, we focus on computing the Banzhaf and Shapley values β i ( G z ) \beta_i(G_z) β i ( G z ) and ϕ i ( G z ) \phi_i(G_z) ϕ i ( G z ) for a single data point z z z , and then average over all data in D \mathcal{D} D to compute β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) and ϕ i ( G D ) \phi_i(G_{\mathcal{D}}) ϕ i ( G D ) . For each classifier i ∈ [ n ] i\in[n] i ∈ [ n ] the power indices β i \beta_i β i and ϕ i \phi_i ϕ i are given by a weighted sum of the marginal gain v B ( S ) − v B ( S − i ) v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i) v B ( S ) − v B ( S − i ) , over all coalitions S ⊆ [ n ] S\subseteq[n] S ⊆ [ n ] with i ∈ S i\in S i ∈ S . We observe that for a correct classifier, if S − i ≠ ∅ S-i\ne\varnothing S − i = ∅ then a non-zero marginal gain can only attain value 1 2 \frac{1}{2} 2 1 ; and a symmetrical argument applies to an incorrect classifier. Furthermore, a marginal gain of 1 2 \frac{1}{2} 2 1 is attained only in two cases, namely, (a) if the classifier i i i introduces a tie, in which case v B ( S − i ) = 0 v_{\mathrm{B}}(S-i)=0 v B ( S − i ) = 0 and v B ( S ) = 1 2 v_{\mathrm{B}}(S)=\frac{1}{2} v B ( S ) = 2 1 ; or (b) if it breaks a tie, in which case v B ( S − i ) = 1 2 v_{\mathrm{B}}(S-i)=\frac{1}{2} v B ( S − i ) = 2 1 and v B ( S ) = 1 v_{\mathrm{B}}(S)=1 v B ( S ) = 1 . This key observation is formalized in Lemma C.1 . Interestingly, given the special structure of the sets S − i S-i S − i , we can compute efficiently the number of such coalitions through combinatorial arguments. In addition, by combining with symmetry arguments we obtain our efficient algorithms from Theorem 3.4 .
We now show the closed-form solutions of the power indices.
Theorem 4.1 (Banzhaf). Let C \mathcal{C} C be an ensemble, and z = ( x , y ) ∈ D z=(x,y)\in\mathcal{D} z = ( x , y ) ∈ D be a test data point. Let n + = ∣ { C ∈ C : C ( x ) = y } ∣ n_+=|\{C\in\mathcal{C}:C(x)=y\}| n + = ∣ { C ∈ C : C ( x ) = y } ∣ be the number of classifiers in C \mathcal{C} C that make a correct prediction for z z z , and n − = n − n + n_-=n-n_+ n − = n − n + the number of classifiers that make an incorrect prediction. For each i ∈ [ n ] i\in[n] i ∈ [ n ] it is
β i ( G z ) = 1 2 n ( ( n n − ) + 1 ) if C i ( x ) = y , β i ( G z ) = − 1 2 n ( ( n n + ) − 1 ) if C i ( x ) ≠ y . (4) \beta_i(G_z)=\frac{1}{2^n}\left(\binom{n}{n_-}+1\right)\ \text{ if } C_i(x)=y,\qquad\beta_i(G_z)=-\frac{1}{2^n}\left(\binom{n}{n_+}-1\right)\ \text{ if } C_i(x)\ne y. \tag*{(4)} β i ( G z ) = 2 n 1 ( ( n − n ) + 1 ) if C i ( x ) = y , β i ( G z ) = − 2 n 1 ( ( n + n ) − 1 ) if C i ( x ) = y . (4)
Theorem 4.2 (Shapley). Under the same notation as in Theorem 4.1 , for each i ∈ [ n ] i \in[n] i ∈ [ n ] it is
ϕ i ( G z ) = 1 n + T + 2 if C i ( x ) = y , ϕ i ( G z ) = − T − 2 if C i ( x ) ≠ y , (5) \phi_i(G_z) = \frac{1}{n}+\frac{T_+}{2}\quad\text{if }C_i(x)=y,\qquad\phi_i(G_z) = -\frac{T_-}{2}\quad\text{if }C_i(x)\ne y, \tag*{(5)} ϕ i ( G z ) = n 1 + 2 T + if C i ( x ) = y , ϕ i ( G z ) = − 2 T − if C i ( x ) = y , (5) where, if we let σ ∈ { + , − } \sigma\in\{+,-\} σ ∈ { + , − } and τ ∈ { + , − } \tau\in\{+,-\} τ ∈ { + , − } with σ ≠ τ \sigma\ne\tau σ = τ then
T σ = ( n − 2 n σ ) ! ( 2 n σ − 1 ) ! n ! ( n τ n σ ) + ∑ h = 1 min { n τ , n σ − 1 } ( n σ − 1 h − 1 ) ( n τ h ) ( n − 2 h − 1 ) ! ( 2 h − 1 ) ! n ! ( 2 n σ + n − 4 h ) , T_\sigma=\frac{(n-2n_\sigma)!(2n_\sigma-1)!}{n!}\binom{n_\tau}{n_\sigma}+\sum_{h=1}^{\min\{n_\tau,n_\sigma-1\}}\binom{n_\sigma-1}{h-1}\binom{n_\tau}{h}\frac{(n-2h-1)!(2h-1)!}{n!}(2n_\sigma+n-4h), T σ = n ! ( n − 2 n σ )! ( 2 n σ − 1 )! ( n σ n τ ) + h = 1 ∑ m i n { n τ , n σ − 1 } ( h − 1 n σ − 1 ) ( h n τ ) n ! ( n − 2 h − 1 )! ( 2 h − 1 )! ( 2 n σ + n − 4 h ) , where ( m k ) = 0 \binom{m}{k}=0 ( k m ) = 0 , for any k > m k>m k > m or k < 0 k<0 k < 0 .
The proofs of Theorems 4.1 and 4.2 are given in Sec. C.3. The resulting approach is shown in Algorithm 1. It receives as input the power index ψ ∈ { ϕ , β } \psi\in\{\phi,\beta\} ψ ∈ { ϕ , β } to be computed, the trained ensemble C \mathcal{C} C , and the test dataset D \mathcal{D} D . The algorithm initializes ψ i = 0 \psi_i=0 ψ i = 0 , for all i ∈ [ n ] i \in[n] i ∈ [ n ] , and then iterates over all data points in D \mathcal{D} D . For each data point ( x , y ) (x,y) ( x , y ) , it computes n + n_+ n + , the number of classifiers that correctly predict the current label y y y . It uses n + n_+ n + to compute ψ i \psi_i ψ i via a closed-form solution through subroutine Get_ψ \psi ψ , the details of which are provided in Algorithm 2. The correctness of Algorithm 1 follows from Theorems 4.1 and 4.2 and the linearity of power indices.
To bound the time complexity we assume that evaluating the prediction C ( x ) C(x) C ( x ) of each classifier C ∈ C C \in\mathcal{C} C ∈ C can be done in O ( 1 ) O(1) O ( 1 ) time, and that each arithmetic operation takes O ( 1 ) O(1) O ( 1 ) time.3 The correctness of Theorem 3.4 and stated complexity follows immediately as a corollary of Theorems 4.1 to 4.3 .
Theorem 4.3. Algorithm 1 computes the Banzhaf values ψ i = β i ( G D ) \psi_i=\beta_i(G_{\mathcal{D}}) ψ i = β i ( G D ) and the Shapley values ψ i = ϕ i ( G D ) \psi_i=\phi_i(G_{\mathcal{D}}) ψ i = ϕ i ( G D ) over the game G D G_{\mathcal{D}} G D in time O ( ∣ D ∣ n ) O(|\mathcal{D}|n) O ( ∣ D ∣ n ) . The memory required is O ( n ) O(n) O ( n ) .
Multiclass classification
Intuition. Let C i C_i C i be a correct classifier; an analogous argument will apply to an incorrect classifier. Consider all coalitions S ⊆ [ n ] S \subseteq[n] S ⊆ [ n ] containing i i i where C i C_i C i yields non-zero marginal contribution v M C ( S ) − v M C ( S − i ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) v MC ( S ) − v MC ( S − i ) . These are the only coalitions that contribute to the power indices ϕ i \phi_i ϕ i or β i \beta_i β i . We characterize the structure of these coalitions and the exact marginal gain introduced by C i C_i C i in Lemma C.2 . Since the multiclass setting introduces a much more complex structure, we cannot count these coalitions directly. Instead, we leverage ordinary generating functions [13 , 17 ] (see Def. B.9 ).
Fix an integer h ≥ 1 h \ge1 h ≥ 1 and consider coalitions of incorrect classifiers where no incorrect label receives more than h h h votes. We design a polynomial P h ( t ) P_h(t) P h ( t ) with variable t t t , where the k k k -th coefficient [ t k ] P h ( t ) [t^k]P_h(t) [ t k ] P h ( t ) is the number of coalitions in S ( k , h ) S(k,h) S ( k , h ) , i.e., coalitions where exactly k k k incorrect labels receive h h h votes, and all remaining labels receive fewer than h h h votes (Lemma 4.4 ). To form a coalition in S ( k , h ) S(k,h) S ( k , h ) , we select, independently for each incorrect label y j y_j y j , j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] , either: (a) fewer than h h h classifiers; or (b) exactly h h h of the n j n_j n j classifiers voting for y j y_j y j ; and case (b) holds for exactly k k k labels. There are A j ( h ) = ∑ q = 0 h − 1 ( n j q ) A_j(h)=\sum_{q=0}^{h-1}\binom{n_j}{q} A j ( h ) = ∑ q = 0 h − 1 ( q n j ) ways to select classifiers for case (a) and B j ( h ) = ( n j h ) B_j(h)=\binom{n_j}{h} B j ( h ) = ( h n j ) ways to select classifiers for case (b). We multiply B j ( h ) B_j(h) B j ( h ) by t t t , such that the coefficient of t k t^k t k is the number of incorrect labels for case (b). This yields P h ( t ) = ∏ j = 2 ℓ ( A j ( h ) + B j ( h ) t ) P_h(t)=\prod_{j=2}^{\ell}(A_j(h)+B_j(h)t) P h ( t ) = ∏ j = 2 ℓ ( A j ( h ) + B j ( h ) t ) of degree at most ℓ − 1 \ell-1 ℓ − 1 , with [ t k ] P h ( t ) = ∣ S ( k , h ) ∣ [t^k]P_h(t)=|S(k,h)| [ t k ] P h ( t ) = ∣ S ( k , h ) ∣ . We then show that the marginal gain of a correct classifier on a coalition formed by correct classifiers and a coalition in S ( k , h ) S(k,h) S ( k , h ) depends only on k k k and on whether there are h − 1 h-1 h − 1 or h h h other correct classifiers (Lemma C.2 ). We use this result to obtain the Banzhaf value β i \beta_i β i for each correct classifier i i i by summing the marginal gains weighted by [ t k ] P h ( t ) [t^k]P_h(t) [ t k ] P h ( t ) for h ∈ [ n ] h \in[n] h ∈ [ n ] and k ∈ [ ℓ − 1 ] k \in[\ell-1] k ∈ [ ℓ − 1 ] (Theorem 4.6 ). Dividing P h ( t ) P_h(t) P h ( t ) by the factor ( A j ( h ) + B j ( h ) t ) (A_j(h)+B_j(h)t) ( A j ( h ) + B j ( h ) t ) of label y j y_j y j yields β i \beta_i β i for all classifiers voting for y j y_j y j , j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] (Corollary 4.5 ). Each P h ( t ) P_h(t) P h ( t ) can be computed in O ( ℓ 2 ) O(\ell^2) O ( ℓ 2 ) time.
On the other hand, the Shapley formula weights each coalition S S S by a function of its size ∣ S ∣ |S| ∣ S ∣ , while each coefficient [ t k ] P h ( t ) [t^k]P_h(t) [ t k ] P h ( t ) counts coalitions of different sizes together. To fix this issue we rely on a bivariate polynomial P h ( t , u ) P_h(t,u) P h ( t , u ) whose coefficient [ t k u q ] P h ( t , u ) [t^ku^q]P_h(t,u) [ t k u q ] P h ( t , u ) is the number of coalitions in S ( k , h ) S(k,h) S ( k , h ) with exactly m m m classifiers (Lemma C.5). To do this, we track the size of the coalitions through a second variable u u u : (i) in case (a) above, selecting q < h q<h q < h classifiers voting for y j y_j y j contributes u q u^q u q ; while (ii) in case (b), selecting h h h classifiers contributes t u h tu^h t u h . The degrees of P h ( t , u ) P_h(t,u) P h ( t , u ) in t t t and u u u are at most ℓ − 1 \ell-1 ℓ − 1 and n n n , respectively. We compute P h ( t , u ) P_h(t,u) P h ( t , u ) by dynamic programming, and obtain the Shapley values by combining the coefficients of these polynomials over h ≥ 1 h \ge1 h ≥ 1 as in the Banzhaf case. We also develop an algorithm based on fast polynomial multiplication in Sec. H.2.
Finally, for the computation of both Banzhaf and Shapley values, we heavily exploit symmetries to avoid redundant computations, achieving a highly-optimized algorithm in practice. We proceed to state our technical results; the proofs are given in Sec. C.
Computation of Banzhaf values in the multiclass setting
We first introduce the univariate polynomial we use to compute efficiently the Banzhaf values.
Lemma 4.4. Let z = ( x , y ) z=(x,y) z = ( x , y ) be a test data point. For any h ≥ 1 h \ge1 h ≥ 1 , consider the generating function
P h ( t ) = ∏ j = 2 ℓ ( A j ( h ) + B j ( h ) t ) , where A j ( h ) = ∑ q = 0 h − 1 ( n j q ) and B j ( h ) = ( n j h ) . P_h(t)=\prod_{j=2}^{\ell}\left(A_j(h)+B_j(h)t\right),\quad\text{where}\quad A_j(h)=\sum_{q=0}^{h-1}\binom{n_j}{q}\quad\text{and}\quad B_j(h)=\binom{n_j}{h}. P h ( t ) = j = 2 ∏ ℓ ( A j ( h ) + B j ( h ) t ) , where A j ( h ) = q = 0 ∑ h − 1 ( q n j ) and B j ( h ) = ( h n j ) . Fix h ∈ [ n ] h \in[n] h ∈ [ n ] and k ∈ [ ℓ − 1 ] k \in[\ell-1] k ∈ [ ℓ − 1 ] . Let S ( k , h ) S(k,h) S ( k , h ) be the set of coalitions S ⊆ C ′ S \subseteq C' S ⊆ C ′ such that: (i) C ′ = C ∖ { C ∈ C : C ( x ) = y } C'=C\setminus\{C\in C:C(x)=y\} C ′ = C ∖ { C ∈ C : C ( x ) = y } ; (ii) ∣ M ( S ) ∣ = k |\mathcal{M}(S)|=k ∣ M ( S ) ∣ = k ; (iii) p j ( S ) = h p_j(S)=h p j ( S ) = h for each j ∈ M ( S ) j\in\mathcal{M}(S) j ∈ M ( S ) . Then ∣ S ( k , h ) ∣ = [ t k ] P h ( t ) |S(k,h)|=[t^k]P_h(t) ∣ S ( k , h ) ∣ = [ t k ] P h ( t ) .
In other words, the coefficients of P h ( t ) P_h(t) P h ( t ) correspond to the number of sets ∣ S ( k , h ) ∣ |S(k,h)| ∣ S ( k , h ) ∣ that are used to obtain a closed-form solution for β i ( G z ) \beta_i(G_z) β i ( G z ) , for all correct classifiers C i C_i C i . To obtain β ( G z ) \beta(G_z) β ( G z ) for all C i C_i C i voting for an incorrect label y j ≠ y y_j\ne y y j = y , we need to remove the contribution of classifiers voting for y j y_j y j from the sets in S ( k , h ) S(k,h) S ( k , h ) as specified by the next corollary.
Corollary 4.5. Under the setting of Lemma 4.4 , fix j ∈ { 2 , … , ℓ } j\in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } , and let S − j ( k , h ) S_{-j}(k,h) S − j ( k , h ) be defined analogously to S ( k , h ) S(k,h) S ( k , h ) for coalitions S ⊆ C ′ ∖ { C ∈ C : C ( x ) = y j } S\subseteq C'\setminus\{C\in C:C(x)=y_j\} S ⊆ C ′ ∖ { C ∈ C : C ( x ) = y j } . That is, no coalition S S S from S − j ( k , h ) S_{-j}(k,h) S − j ( k , h ) contains a classifier voting for class y j y_j y j . Then it holds that
∣ S − j ( k , h ) ∣ = [ t k ] P h ( t ) A j ( h ) + B j ( h ) t . |S_{-j}(k,h)|=[t^k]\frac{P_h(t)}{A_j(h)+B_j(h)t}. ∣ S − j ( k , h ) ∣ = [ t k ] A j ( h ) + B j ( h ) t P h ( t ) .
We show how to use the coefficients of P h ( t ) P_h(t) P h ( t ) to obtain a closed-form solution for β i \beta_i β i ’s.
Theorem 4.6. Let z = ( x , y 1 ) ∈ D z=(x,y_1)\in\mathcal{D} z = ( x , y 1 ) ∈ D be a test data point. Let f 1 ( k , h ) = k ( n 1 − 1 h ) + ( n 1 − 1 h − 1 ) f_1(k,h)=k^{\binom{n_1-1}{h}}+\binom{n_1-1}{h-1} f 1 ( k , h ) = k ( h n 1 − 1 ) + ( h − 1 n 1 − 1 ) for any k , h ≥ 0 k,h\ge0 k , h ≥ 0 and f j ( k , h ) = ( n j h ) [ ( n j − 1 h ) + 1 k + 1 ( n j − 1 h − 1 ) ] f_j(k,h)=\binom{n_j}{h}\left[\binom{n_j-1}{h}+\frac{1}{k+1}\binom{n_j-1}{h-1}\right] f j ( k , h ) = ( h n j ) [ ( h n j − 1 ) + k + 1 1 ( h − 1 n j − 1 ) ] for any k , h ≥ 0 k,h\ge0 k , h ≥ 0 and j ∈ { 2 , … , ℓ } j\in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } . For any correct classifier C i C_i C i with C i ( x ) = y 1 C_i(x)=y_1 C i ( x ) = y 1 and any incorrect classifier i ′ i' i ′ with C i ′ ( x ) = y j C_{i'}(x)=y_j C i ′ ( x ) = y j it holds
β i = 1 2 n − 1 ( 1 + ∑ h = 1 n 1 ∑ k = 0 ℓ − 1 f 1 ( k , h ) k + 1 [ t k ] P h ( t ) ) \beta_i=\frac{1}{2^{n-1}}\left(1+\sum_{h=1}^{n_1}\sum_{k=0}^{\ell-1}\frac{f_1(k,h)}{k+1}[t^k]P_h(t)\right) β i = 2 n − 1 1 ( 1 + h = 1 ∑ n 1 k = 0 ∑ ℓ − 1 k + 1 f 1 ( k , h ) [ t k ] P h ( t ) ) and
β i ′ = − 1 2 n − 1 ∑ h = 1 n j ∑ k = 0 ℓ − 2 f j ( k , h ) k + 2 [ t k ] P h ( t ) A j ( h ) + B j ( h ) t . \beta_{i'}=-\frac{1}{2^{n-1}}\sum_{h=1}^{n_j}\sum_{k=0}^{\ell-2}\frac{f_j(k,h)}{k+2}[t^k]\frac{P_h(t)}{A_j(h)+B_j(h)t}. β i ′ = − 2 n − 1 1 h = 1 ∑ n j k = 0 ∑ ℓ − 2 k + 2 f j ( k , h ) [ t k ] A j ( h ) + B j ( h ) t P h ( t ) .
Theorem 4.6 has strong algorithmic implications: by computing the coefficients of polynomials P h ( t ) P_h(t) P h ( t ) and P h ( t ) / ( A j + B j ( t ) ) P_h(t)/(A_j+B_j(t)) P h ( t ) / ( A j + B j ( t )) , for j ∈ { 2 , … , ℓ } j\in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } and h ≥ 1 h\ge1 h ≥ 1 , we can efficiently compute β i ( G z ) \beta_i(G_z) β i ( G z ) for all i ∈ [ n ] i\in[n] i ∈ [ n ] and z ∈ D z\in\mathcal{D} z ∈ D . We detail the entire procedure in Algorithm 3, which, in addition to the closed-form solutions of Theorem 4.6, exploits symmetries to further reduce the time complexity.
Theorem 4.7. Algorithm 3 computes the exact Banzhaf values β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) of the base classifiers of an ensemble C C C in the multiclass setting in time O ( ∣ U ∣ n ℓ 2 + ∣ D ∣ n ) \mathcal{O}(|U|n\ell^2+|D|n) O ( ∣ U ∣ n ℓ 2 + ∣ D ∣ n ) . The memory required is O ( ℓ ( n + ∣ U ∣ ) ) \mathcal{O}(\ell(n+|U|)) O ( ℓ ( n + ∣ U ∣ )) .
We can further reduce the complexity of computing P h ( t ) P_h(t) P h ( t ) from O ( ℓ 2 ) \mathcal{O}(\ell^2) O ( ℓ 2 ) to O ( ℓ log ℓ ) \mathcal{O}(\ell\log\ell) O ( ℓ log ℓ ) by performing polynomial multiplication via the fast Fourier transform (FFT) algorithm, at the expense of higher constants and a more complex implementation. In practice, we find that our O ( ℓ 2 ) \mathcal{O}(\ell^2) O ( ℓ 2 ) solution is highly efficient, as shown in our experimental evaluation (e.g., see Table 5 ).
Table 5. Runtime (seconds) of ENPOWER on D v a l \mathcal{D}_{\mathrm{val}} D val in the multiclass setting. The results are the average and standard deviation over five random splits. ENPOWERM C _{\mathrm{MC}} MC -ϕ \phi ϕ ++ corresponds to the refined algorithm of Sec. H.
Computation of Shapley values in the multiclass setting
As already mentioned, we cannot use P h ( t ) P_h(t) P h ( t ) to obtain the values of ϕ i ( G z ) \phi_i(G_z) ϕ i ( G z ) , since the k k k -th coefficient [ t k ] P h ( t ) [t^k]P_h(t) [ t k ] P h ( t ) accounts for sets of different cardinality. To fix this issue, we design a bivariate ordinary generating function allowing us to keep track of the size of each set contributing to S ( k , h ) S(k,h) S ( k , h ) by partitioning it as S ( k , h ) = ⋃ m ≥ 1 S ( k , h , m ) S(k,h)=\bigcup_{m\ge1}S(k,h,m) S ( k , h ) = ⋃ m ≥ 1 S ( k , h , m ) and requiring each set of S ( k , h , m ) S(k,h,m) S ( k , h , m ) to have cardinality m m m . We introduce our main result below, while we defer the detailed technical results to Sec. C.5. For h ≥ 1 h \ge1 h ≥ 1 and j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] , let A j ( h ; u ) = ∑ q = 0 h − 1 ( n j q ) u q A_j(h;u)=\sum_{q=0}^{h-1}\binom{n_j}{q}u^q A j ( h ; u ) = ∑ q = 0 h − 1 ( q n j ) u q , B j ( h ; u ) = ( n j h ) u h B_j(h;u)=\binom{n_j}{h}u^h B j ( h ; u ) = ( h n j ) u h , and P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + B j ( h ; u ) t ) P_h(t,u)=\prod_{j=2}^{\ell}(A_j(h;u)+B_j(h;u)t) P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + B j ( h ; u ) t ) . The exponent of u u u will count the classifiers in a coalition, i.e., [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ [t^k u^m]P_h(t,u)=|S(k,h,m)| [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ (see Lemma C.5). When u = 1 u=1 u = 1 we recover A j ( h ) A_j(h) A j ( h ) , B j ( h ) B_j(h) B j ( h ) and P h ( t ) P_h(t) P h ( t ) from Lemma 4.4 . For ease of notation let η ( a ) = ( n − a ) ! ( a − 1 ) ! n ! \eta(a)=\frac{(n-a)!(a-1)!}{n!} η ( a ) = n ! ( n − a )! ( a − 1 )! , for 1 ≤ a ≤ n 1 \le a \le n 1 ≤ a ≤ n . Furthermore, let
f 1 ( k , h , m ) = 1 k + 1 ( ( n 1 − 1 h ) η ( m + h + 1 ) + ( n 1 − 1 h − 1 ) η ( m + h ) ) f_1(k,h,m)=\frac{1}{k+1}\left(\binom{n_1-1}{h}\eta(m+h+1)+\binom{n_1-1}{h-1}\eta(m+h)\right) f 1 ( k , h , m ) = k + 1 1 ( ( h n 1 − 1 ) η ( m + h + 1 ) + ( h − 1 n 1 − 1 ) η ( m + h ) )
and
f j ( k , h , m ) = 1 k + 2 ( n 1 h ) [ ( n j − 1 h ) η ( m + 2 h + 1 ) + 1 k + 1 ( n j − 1 h − 1 ) η ( m + 2 h ) ] , j ∈ [ 2 , ℓ ] . f_j(k,h,m)=\frac{1}{k+2}\binom{n_1}{h}\left[\binom{n_j-1}{h}\eta(m+2h+1)+\frac{1}{k+1}\binom{n_j-1}{h-1}\eta(m+2h)\right],\quad j\in[2,\ell]. f j ( k , h , m ) = k + 2 1 ( h n 1 ) [ ( h n j − 1 ) η ( m + 2 h + 1 ) + k + 1 1 ( h − 1 n j − 1 ) η ( m + 2 h ) ] , j ∈ [ 2 , ℓ ] .
By convention, a term with a zero binomial is 0, irrespective of the argument of η ( ⋅ ) \eta(\cdot) η ( ⋅ ) .
Theorem 4.8. Let z = ( x , y ) ∈ D z=(x,y)\in D z = ( x , y ) ∈ D be a test data point. For any classifier C i C_i C i making a correct prediction, i.e., C i ( x ) = y 1 C_i(x)=y_1 C i ( x ) = y 1 , it holds that its Shapley value over G z G_z G z is given by
ϕ i ( G z ) = 1 n + ∑ h = 1 n 1 ∑ k = 1 ℓ − 1 ∑ m = k h n − n 1 f 1 ( k , h , m ) [ t k u m ] P h ( t , u ) . \phi_i(G_z)=\frac{1}{n}+\sum_{h=1}^{n_1}\sum_{k=1}^{\ell-1}\sum_{m=kh}^{n-n_1}f_1(k,h,m)[t^k u^m]P_h(t,u). ϕ i ( G z ) = n 1 + h = 1 ∑ n 1 k = 1 ∑ ℓ − 1 m = k h ∑ n − n 1 f 1 ( k , h , m ) [ t k u m ] P h ( t , u ) . Furthermore, for any classifier C i C_i C i predicting an incorrect class C i ( x ) = y j C_i(x)=y_j C i ( x ) = y j , j ∈ { 2 , … , ℓ } j\in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } it holds
− ϕ i ( G z ) = ∑ h = 1 n j ∑ k = 0 ℓ − 2 ∑ m = h k n − ( n 1 + n j ) f j ( k , h , m ) [ t k u m ] P h ( t , u ) A j ( h ; u ) + B j ( h ; u ) t . -\phi_i(G_z)=\sum_{h=1}^{n_j}\sum_{k=0}^{\ell-2}\sum_{m=hk}^{n-(n_1+n_j)}f_j(k,h,m)[t^k u^m]\frac{P_h(t,u)}{A_j(h;u)+B_j(h;u)t}. − ϕ i ( G z ) = h = 1 ∑ n j k = 0 ∑ ℓ − 2 m = hk ∑ n − ( n 1 + n j ) f j ( k , h , m ) [ t k u m ] A j ( h ; u ) + B j ( h ; u ) t P h ( t , u ) .
The above result implies that computing the coefficients of the polynomials P h ( t , u ) P_h(t,u) P h ( t , u ) , with degrees bounded by ℓ − 1 \ell-1 ℓ − 1 in t t t and n − n 1 n-n_1 n − n 1 in u u u , enables a closed-form solution for ϕ i \phi_i ϕ i . To compute the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) we develop a dynamic-programming algorithm presented in Sec. D.
Theorem 4.9. Algorithm 4 computes the exact Shapley values ϕ i ( G D ) \phi_i(G_D) ϕ i ( G D ) of the base classifiers of an ensemble C C C in the multiclass setting in time O ( ∣ U ∣ n 3 ℓ + ∣ D ∣ n ) O(|U|n^3\ell+|D|n) O ( ∣ U ∣ n 3 ℓ + ∣ D ∣ n ) . The memory required is O ( ℓ ( n + ∣ U ∣ ) ) O(\ell(n+|U|)) O ( ℓ ( n + ∣ U ∣ )) .
We further introduce ENPOWERM C _{\mathrm{MC}} MC -ϕ \phi ϕ ++, improving the above time complexity bound in Sec. H, which we evaluate in Sec. G.6. The underlying idea of such method is to reduce the size of the dynamic programming matrices used to evaluate Theorem 4.8 , we defer to Sec. H for more details.
Experiments
We consider the following research questions: (Q1) evaluate the efficiency and scalability of ENPOWER; (Q2) compare the rankings produced by ENPOWER and existing methods; (Q3) investigate the use of the rankings of ENPOWER for ensemble pruning; and (Q4) use ENPOWER for prompt ensembling of vision models on a zero-shot learning classification task. We defer to Sec. G.6 for synthetic experiments validating the tightness of our time complexity bounds.
Algorithms. Our algorithms for exact computation are denoted by ENPOWER-ϕ \phi ϕ and ENPOWER-β \beta β .
Binary classification. We consider the following baselines, described in detail in Sec. F.1: ISCG [47 ] ; Tr-MLE [34 ] ; Tr-PS [27 ] ; and WMG [42 ] . These baselines are associated with games defined in prior work. We also consider MC-ϕ \phi ϕ and MC-β \beta β : Monte-Carlo approximations with sample size set to n 2 n^2 n 2 .
Multiclass classification. We only show the scalability of ENPOWER (see Table 5 ), as all other methods, with the exception of ISCG, are not applicable to the multiclass setting, or have very high runtime. We show an application of the output of ENPOWER for the multiclass setting in § 5.4 . For the prompt-ensembling of § 5.4 we also consider Tr-MLE and Tr-PS, which we apply through a “correct-versus-rest” reduction detailed in Sec. F.3.
Setup. Details on our experimental setup are in Sec. F.3 on six popular datasets from the UCI repository (see Sec. F.1). For each dataset we obtain a 75/15/10 split of the data, where 75% is used for training, 15% for computing the power indices, and 10% as test data for the experiments on sub-ensemble selection, see also Sec. F. Baselines Tr-MLE and Tr-PS are from [36 ] . Unless otherwise stated we considered five random (seeded) splits of each dataset, processed as detailed above, and our4 metrics are averaged over such instances. We then execute each method once per split. Except for MC and Tr-PS all other methods are deterministic.
Figure 1. Runtime (mean and standard deviation) on our largest datasets, binary classification.
Ensembles. We consider three different ensembles (i) RF: a random forest with n = 50 n = 50 n = 50 trees; (ii) AB: an ensemble built with AdaBoost containing n = 150 n = 150 n = 150 models; and (iii) HET: and heterogeneous ensemble containing n = 30 n = 30 n = 30 models, 10 decision trees and 5 of each of the remaining types: SVMs, logistic regressors, gradient boosting, and multi layer perceptrons. See Sec. F for more details.
Efficiency and scalability
We start with answering Q1. The results are reported in Figure 1 and Figure 6 . ENPOWER methods are among the fastest for binary classification. Even on the largest datasets, where the sampling methods Tr-PS and MC require up to hundreds and thousands of seconds, respectively, ENPOWER methods terminate in less than one second, as captured by Theorem 4.3 . The exact method WMG is also very efficient, however it requires between one and three orders of magnitude more time than ENPOWER on AB, note that such configuration has the largest number of base classifiers (n = 150 n = 150 n = 150 ). In fact, the dynamic program of Uno [42 ] has a cost at least quadratic in n n n for each game of U U U , while Algorithm 1 evaluates a closed form. ISCG has a comparable runtime to ENPOWER, however it does not faithfully capture plurality voting ensembles (see § 5.2 and Sec. F.3). Finally, Tr-MLE is more than one order of magnitude slower compared to ENPOWER on our largest datasets, while providing only approximate solutions. The runtimes of ENPOWER for the multiclass setting are reported in Table 5 , where we observe a high runtime for computing Shapley values on our largest dataset (CT) on ensemble AB with n = 150 n = 150 n = 150 due to the O ( n 3 ) O(n^3) O ( n 3 ) term in the complexity. We would like to remind, however, that our method is the first specifically tailored to solve the multiclass case.
Figure 6. Runtime comparison (mean and standard deviation) on the missing datasets from Table 1 not reported in § 5 due to space constraints.
Comparison of rankings of base classifiers
Next, we consider Q2. We compare the rankings of the base classifiers produced by ENPOWER and the baselines using Kendall’s τ \tau τ . We recall, that rankings are used for different applications, including ensemble pruning, data validation, and interpretability. We report the results in Figure 2 .
Figure 2. For each pair (dataset, baseline) encoded by a pair (shape, color), we display the Kendall’s τ \tau τ with respect to the exact rankings obtained by ENPOWER-ϕ \phi ϕ and ENPOWER-β \beta β on the x x x -axis, and y y y -axis respectively, averaged over five splits. Each plot corresponds to a different ensemble.
We first observe that ISCG has low ranking correlation with ENPOWER on RF and HET, and a high correlation on AB, except on BTSC. Similarly, except for few instances, the correlations of WMG-β \beta β and ENPOWER-β \beta β do not exceed 0.5. Interestingly, WMG-ϕ \phi ϕ exhibits slightly higher correlations with ENPOWER-ϕ \phi ϕ . Finally, there is quite high correlation (> 0.5 >0.5 > 0.5 ) among the rankings of ENPOWER-ϕ \phi ϕ and Tr-MLE, despite the latter being approximate and on a different game, with the exception of CT on AB.
We note that the correlation values are particularly dependent on the baseline considered. Tr-MLE has τ > 0.5 \tau> 0.5 τ > 0.5 with ENPOWER-ϕ \phi ϕ on most configurations except CT on AB. In contrast, baselines WMG and ISCG range from negative correlation to values above 0.9 for a fixed ensemble and different datasets. For example, the value of τ \tau τ between WMG-β \beta β and ENPOWER-ϕ \phi ϕ on AB is below − 0.3 -0.3 − 0.3 and above 0.8, on datasets C9 and BTSC, respectively. In summary, we observe that ENPOWER provides rankings that are not fully captured by previous methods, providing a unique characterization of plurality-voting ensembles with random tie-breaking.
Sub-ensemble selection
We now consider Q3 . Given an ensemble C \mathcal{C} C and a ranking of its base classifiers, we assess the generalization of the sub-ensemble obtained by retaining the top-k k k classifiers. We use rankings according to ENPOWER and the baselines. We additionally include a baseline ranking base classifiers by their individual accuracy on D v a l \mathcal{D}_{\mathrm{val}} D val , denoted as Acc. For each sub-ensemble we evaluate its accuracy and (macro) F 1 F_1 F 1 -score. We compute the rankings of all methods on D v a l \mathcal{D}_{\mathrm{val}} D val , and both metrics on D t e s t \mathcal{D}_{\mathrm{test}} D test , of the same split. Classifiers with equal values are ordered by increasing index C i C_i C i , i ∈ [ n ] i \in[n] i ∈ [ n ] . We vary the parameter k k k in [ n ] [n] [ n ] . The predictions of a sub-ensemble are obtained by plurality voting with random tie-breaking, i.e., the voting rule of v B v_{\mathrm{B}} v B . That is, for a test point where the two classes receive the same number of votes we draw the prediction uniformly at random. We compute both metrics on the resulting predictions, and report their mean over the five random splits.
We show some representative results in Figure 3 (see Sec. G.4 for an extended discussion). We observe that sub-ensembles produced with rankings by ENPOWER are often among those with the largest accuracy and F 1 F_1 F 1 -score. For example, on CT with HET, ENPOWER matches Acc or outperforms all baselines for all values of k k k ; on BM with AB, ENPOWER matches Acc for all values of k k k , while the accuracy of WMG-β \beta β is much lower than that of all other methods for intermediate values of k k k . Interestingly, on the same configuration, ISCG attains a higher F 1 F_1 F 1 -score for small values of k k k . To answer Q3 , while our methods are not directly optimized for sub-ensemble selection, they can provide a valuable contribution in addition to existing methods, given their high practical applicability.
Figure 3. Generalization metrics for sub-ensemble selection, averaged over five random splits.
Large vision model prompt ensembling
Last, we consider Q4 . Recall that prompt ensembling is an LLM-engineering technique used to improve performance on tasks such as zero-shot image classification [35 ] . Here, we select n = 22 n = 22 n = 22 general-purpose prompt templates, which act as our models; see Table 11 . For each image in the input dataset we first compute its normalized embedding using CLIP, obtaining x i m g \boldsymbol{x}_{\mathrm{img}} x img . Then we proceed as follows: (i) we instantiate each prompt template i ∈ [ n ] i \in[n] i ∈ [ n ] with the ℓ \ell ℓ possible classes, obtaining prompts S i 1 , … , S i ℓ S_i^1,\ldots,S_i^\ell S i 1 , … , S i ℓ ; (ii) we use CLIP to compute the normalized embedding of each of the prompts obtaining vectors v 1 i , … , v ℓ i \boldsymbol{v}_1^i,\ldots,\boldsymbol{v}_\ell^i v 1 i , … , v ℓ i ; (iii) we compute the dot products x i m g ⋅ v j i \boldsymbol{x}_{\mathrm{img}} \cdot\boldsymbol{v}_j^i x img ⋅ v j i ; (iv) we select the class j ⋆ ( i ) = arg max j x i m g ⋅ v j i j^{\star}(i) = \arg\max_j x_{\mathrm{img}} \cdot v_j^{i} j ⋆ ( i ) = arg max j x img ⋅ v j i as vote for model i ∈ [ n ] i \in[n] i ∈ [ n ] ;[4 ] (v) the final predictions of the ensemble are evaluated according to plurality voting with random tie-breaking. We split each dataset in half obtaining D v a l \mathcal{D}_{\mathrm{val}} D val and D t e s t \mathcal{D}_{\mathrm{test}} D test (over five random splits). We use D v a l \mathcal{D}_{\mathrm{val}} D val to compute the rankings of the models according to three different algorithms: ACC: ranking prompts by raw accuracy, a common practice for LLM engineering; ENPOWER-β \beta β and ENPOWER-ϕ \phi ϕ : ranking using our definitions of β \beta β and ϕ \phi ϕ for the multiclass setting. We also rank prompts with Tr-MLE and Tr-PS (see Sec. F.3). The resulting rankings are reported in Table 9 to Table 11 . Finally, we use D t e s t \mathcal{D}_{\mathrm{test}} D test of each split to evaluate the accuracy and F 1 F_1 F 1 -score on the sub-ensemble obtained by retaining only the top-k k k models, for k ∈ { 1 , … , n } k \in\{1,\ldots,n\} k ∈ { 1 , … , n } .
Table 9. Prompt ensemble evaluation for LLM zero-shot multiclass image classification (CIFAR100). Each prompt corresponds to a different model of C C C . All values and rankings are computed on the validation split D v a l \mathcal{D}_{\mathrm{val}} D val . Columns Δ β \Delta_{\beta} Δ β and Δ ϕ \Delta_{\phi} Δ ϕ display the difference in the validation rankings induced by the power indices β ( G M C ) \beta(G_{\mathrm{MC}}) β ( G MC ) and ϕ ( G M C ) \phi(G_{\mathrm{MC}}) ϕ ( G MC ) with respect to validation accuracy.
Table 11. Prompt ensemble evaluation for LLM zero-shot multiclass image classification (IMAGENET-A). Each prompt corresponds to a different model of C C C . All values and rankings are computed on the validation split D v a l \mathcal{D}_{\mathrm{val}} D val . Columns Δ β \Delta_\beta Δ β and Δ ϕ \Delta_\phi Δ ϕ display the difference in the validation rankings induced by the power indices β ( G M C ) \beta(G_{\mathrm{MC}}) β ( G MC ) and ϕ ( G M C ) \phi(G_{\mathrm{MC}}) ϕ ( G MC ) with respect to validation accuracy.
We report the result for the CIFAR and IMAGENET-A datasets in Figure 4 , the missing dataset is in Sec. G.5, and the best and average metrics over k k k in Table 7 . We observe that the sub-ensembles obtained through the rankings computed by ENPOWER attain a higher accuracy and F 1 F_1 F 1 -score than the ones of Tr-MLE and Tr-PS, for the best k k k and on average over all k ∈ [ n ] k \in[n] k ∈ [ n ] , on all three datasets. Importantly, Tr-MLE and Tr-PS not accounting for how incorrect models for the ℓ − 1 \ell- 1 ℓ − 1 incorrect labels, differently from our game vMC (see Secs. A and F.3). Furthermore the selection of ENPOWER matches or improves also over the baseline ACC. We also note that in general, the best performing ensembles (k ∈ [ 1 , 17 ] k \in[1,17] k ∈ [ 1 , 17 ] , see Table 7 ) have smaller sizes than the full ensemble of n = 22 n = 22 n = 22 prompts. Highlighting that using a larger set of prompts to classify challenging images often yields less accurate predictions. Our results suggest that the Banzhaf and Shapley values computed by ENPOWER can be used to improve the predictive power of vision models under prompt ensembling. Another interesting application is enhancing vision model interpretability by comparing the rankings of the prompts across different methods, as shown in Table 9 to Table 11 , for which we defer to the discussion in Sec. G.5.
Figure 4. Accuracy and F 1 F_1 F 1 -score test metrics for the prompt ensembling of CLIP on D t e s t \mathcal{D}_{\mathrm{test}} D test (see § 5.4 ), for varying k k k . We report mean and standard deviation (over multiple splits).
Table 7. Prompt ensembling of CLIP, metrics on D t e s t \mathcal{D}_{\mathrm{test}} D test of the sub-ensemble for varying k k k (see § 5.4 ). Columns report, best: the maximum over k k k of the average over the five random splits, and the k k k attaining it. Avg.: the average over k ∈ [ n ] k \in[n] k ∈ [ n ] . Bold marks the best value for each configuration.
Conclusions
We introduce new characteristic function games modeling the predictions of models in plurality-voting ensembles with random tie-breaking, in binary and multiclass settings. We then design new exact polynomial-time algorithms, named collectively as ENPOWER, to compute the Banzhaf and Shapley values of the models in the ensemble. Our algorithms are based on non-trivial combinatorial identities, and the use of ordinary generating functions for the multiclass case. We show in practice that the indices obtained by ENPOWER: (i) are extremely efficient to compute and are not captured by previous methods; (ii) can be applied to ensemble pruning and LLM prompt ensembling with remarkable results. Interesting future directions include: (i) use our indices for data validation; (ii) study other popular power indices under our new game.
Acknowledgments and Disclosure of Funding
The authors declare no competing interests that could create a conflict of interest. This research was supported by the Swedish Research Council project ExCLUS (2024-05603), the Marie Curie Doctoral Training Network ARMADA (101168951), and the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation. Computational resources were provided on the Berzelius system funded by the Knut and Alice Wallenberg foundation and operated by NAISS.
Limitations
We now list the major limitations and assumptions of our work.
our methods are only applicable to ensembles constituting of base models that provide a hard classification;
there are inputs for which our methods do not match baseline methods; we describe such behavior in § 5 and discuss the related trade-offs. For example, on ensemble sub-selection, our methods may achieve high accuracy but low F 1 F_1 F 1 -score, or vice-versa. To support our findings we provide additional results in Sec. G.
we force each base classifier to provide a hard classification for our experiment regarding prompt ensembling in § 5.4 , to fit our framework. We remark that the original work of [35 ] used soft votes.
LLM usage
Large language models (LLMs) were used to assist portions of this research and manuscript preparation. In particular, LLMs were used to:
assist with proofreading and improving presentation;
help explore proof ideas and check edge cases;
assist with implementation and debugging;
support data analysis and visualization;
assist with literature exploration.
All technical results, proofs, experiments, and conclusions were verified by the authors, who assume full responsibility for the content of the manuscript.
Extended discussion on related work
The generalization of an ensemble is characterized by a bias-variance-diversity complexity trade-off that must be considered during learning [11 , 20 ] . Diversity , which informally captures correlations among the models’ predictions, requires a careful balancing as it directly impacts bias and variance [45 ] . Diversity motivates the need for ensemble pruning [23 , 25 ] , an active area of research [19 , 48 ] , which aims at selecting a sub-ensemble with better generalization performance, reducing significantly the size of the full ensemble and controlling the bias-variance-diversity trade-off. Our methods provide a valuable addition to existing pruning techniques (as we show in § 5 ), especially given the efficiency of ENPOWER and the fact that we our methods are model-agnostic. We defer to dedicated textbooks and surveys for more details [37 , 49 ] .
Weighted majority games (WMGs) have been studied extensively in the literature, and under unitary weights, power indices for WMGs can be computed in polynomial time [17 , 42 ] . However, as we discuss below, WMGs do not capture our setting. First, we recall that a WMG is a simple game, i.e., a monotone game in which coalitions are rewarded with values that are either 0 or 1, and that its quota, which is necessary for achieving a majority, is fixed in advance (see Def. B.6 ). Consider an ensemble C C C with unitary weights, as in our setting, and a quota q ∈ [ n ] q \in[n] q ∈ [ n ] . Given a model i ∈ [ n ] i \in[n] i ∈ [ n ] and a coalition S S S such that i ∉ S i \notin S i ∈ / S , the marginal contribution v ( S + i ) − v ( S ) v(S + i) - v(S) v ( S + i ) − v ( S ) is nonzero if and only if ∣ S ∣ = q − 1 |S| = q - 1 ∣ S ∣ = q − 1 . That is, the Shapley and Banzhaf values of model i ∈ [ n ] i \in[n] i ∈ [ n ] in a WMG depend only on the coalitions of size q − 1 q - 1 q − 1 . For example, under the majority quota q = ⌊ n / 2 ⌋ + 1 q = \lfloor n/2 \rfloor+ 1 q = ⌊ n /2 ⌋ + 1 , no coalition with fewer than ⌊ n / 2 ⌋ \lfloor n/2 \rfloor ⌊ n /2 ⌋ classifiers contributes to the power indices of the models. In our experiments, we rank the models by their power indices and retain the top-k k k models, for every k ∈ [ n ] k \in[n] k ∈ [ n ] (see § 5 ). When k < ⌊ n / 2 ⌋ k < \lfloor n/2 \rfloor k < ⌊ n /2 ⌋ , the power indices of a WMG ignore every coalition of size at most k k k . In contrast, under our game, the power indices can depend on coalitions of any size (see Lemma C.1 ).
Furthermore, most of the existing game formulations on which prior work is based, including the works by Rozemberczki and Sarkar [36 ] , Uno [42 ] and Ykhlef and Bouchaffra [46 ] cannot be adapted to the multiclass setting without incurring high computational cost and loss in information. The reason is that typical approaches define O ( ℓ ) \mathcal{O}(\ell) O ( ℓ ) binary games and aggregate the indices over all pairs retaining the correct label, or all possible pairs solving O ( ℓ 2 ) \mathcal{O}(\ell^2) O ( ℓ 2 ) binary games. Despite being inefficient, this approach does not capture how the predictions for different classes interact with each other, as it is done by our definition of v M C v_{\mathrm{MC}} v MC . Note that the work by Ykhlef and Bouchaffra [47 ] is the only method applicable for the multiclass setting, which however does not model accurately how the base models interact over the final ensembles’ predictions. That is, the work of [47 ] assumes that classifiers correspond to nodes on a clique Q Q Q , and the characteristic function for a subset S S S of models is proportional to the weighted volume of the induced subgraph Q [ S ] Q[S] Q [ S ] , using the classical result from Deng and Papadimitriou [10 ] (see also Sec. F.3). This differs significantly from aggregation mechanisms used in ensemble models.
Finally, the rule underlying our characteristic function v M C v_{\mathrm{MC}} v MC , i.e., plurality voting with tie-breaking, has been studied in social choice. Bolger [5 ] and Amer et al. [1 ] extend the Banzhaf index to games with r r r alternatives (here r = ℓ r = \ell r = ℓ ). Their characteristic function is defined on the partitions of the players into r r r groups, one per alternative. The marginal contribution of a player p p p corresponds to the variation in the value of the characteristic function when the vote of p p p moves from one group to another. The resulting power index evaluates the marginal contributions over the partitions of [ n ] [n] [ n ] , of which there are ℓ n \ell^n ℓ n , instead of over the 2 n 2^n 2 n coalitions considered in our work. Note that such indices range over all possible votes, thus in an unweighted setting all players are symmetric, and every player receives the same value, i.e., the indices cannot distinguish the classifiers. Kurz et al. [21 ] , Mayer and Napel [29 ] characterize the weight vectors that yield the same outcome for every voting profile under plurality and other voting rules, and Kurz et al. [22 ] define new power indices for weighted committees. Chua et al. [8 ] compare power indices for weighted plurality, modeled as a simple game. We remark that none of the above works considers a notion of correctness for the votes of the players. In contrast, our power indices are computed for the votes of the classifiers, and vary across classifiers with different predictions even though the votes are unweighted, as shown both by our theoretical results (see Theorems 4.6 and 4.8 ) and in practice (see § 5 ).
Background
Cooperative game theory
Both the Banzhaf and Shapley values are grounded in well-established axiomatic foundations from cooperative game theory [7 ] , which we recall below. The Shapley values is uniquely characterized by the four properties of dummy player, symmetry, linearity, and efficiency, whereas the Banzhaf value satisfies the properties of dummy player, symmetry and linearity.
Property B.1 (Dummy player). Given a game G = ( N , v ) G=(N,v) G = ( N , v ) a player i ∈ N i\in N i ∈ N is said to be a dummy player if it holds that v ( S + i ) = v ( S ) v(S+i)=v(S) v ( S + i ) = v ( S ) for all coalitions S ⊆ [ N ] S\subseteq[N] S ⊆ [ N ] that do not contain i i i . The value ψ i ( v ) \psi_i(v) ψ i ( v ) of a dummy player in a game G G G should equal to 0.
Property B.2 (Symmetry). If i i i and j j j are two players in a game G = ( N , v ) G=(N,v) G = ( N , v ) who are equivalent, in the sense that v ( S + i ) = v ( S + j ) v(S+i)=v(S+j) v ( S + i ) = v ( S + j ) for any coalition S ⊆ N S\subseteq N S ⊆ N that contains neither i i i nor j j j , then it should be ψ i ( v ) = ψ j ( v ) \psi_i(v)=\psi_j(v) ψ i ( v ) = ψ j ( v ) .
Property B.3 (Linearity). If two coalition games G v = ( N , v ) G_v=(N,v) G v = ( N , v ) and G w = ( N , w ) G_w=(N,w) G w = ( N , w ) are combined, then their combined values should correspond to the values derived from v v v and the values derived from w w w , that is, it should be ψ i ( v + w ) = ψ i ( v ) + ψ i ( w ) \psi_i(v+w)=\psi_i(v)+\psi_i(w) ψ i ( v + w ) = ψ i ( v ) + ψ i ( w ) , for every i ∈ N i\in N i ∈ N . Also, for any real number α \alpha α , it should be ψ i ( α v ) = α ψ i ( v ) \psi_i(\alpha v)=\alpha\psi_i(v) ψ i ( α v ) = α ψ i ( v ) , for every i ∈ N i\in N i ∈ N .
Property B.4 (Efficiency). The sum of the values of all players in a game G = ( N , v ) G=(N,v) G = ( N , v ) should be equal to the value of the grand coalition, i.e., ∑ i ∈ N ψ i ( v ) = v ( N ) \sum_{i\in N}\psi_i(v)=v(N) ∑ i ∈ N ψ i ( v ) = v ( N ) .
A sum game is the cooperative game whose characteristic function is the pointwise sum of those of a set of games defined over the same set of players.
Definition B.5 (Sum game). Given an integer k ≥ 2 k\ge2 k ≥ 2 , and characteristic function games G 1 = ( N , v 1 ) , … , G k = ( N , v k ) G_1=(N,v_1),\ldots,G_k=(N,v_k) G 1 = ( N , v 1 ) , … , G k = ( N , v k ) the sum of G 1 , … , G k G_1,\ldots,G_k G 1 , … , G k denoted with G + = G 1 + ⋯ + G k = ∑ i G i G_+=G_1+\cdots+G_k=\sum_i G_i G + = G 1 + ⋯ + G k = ∑ i G i is a game G + = ( N , v + ) G_+=(N,v_+) G + = ( N , v + ) such that for any coalition S ⊆ N S\subseteq N S ⊆ N it holds v + ( S ) = ∑ i = 1 k v i ( S ) v_+(S)=\sum_{i=1}^{k}v_i(S) v + ( S ) = ∑ i = 1 k v i ( S ) .
Weighted majority games (WMGs) are a classical model of voting systems in which each player carries a weight and a coalition wins precisely when its total weight reaches a fixed quota [7 , 28 ] .
Definition B.6 (Weighted majority game (WMG)). Let N = { 1 , … , n } N=\{1,\ldots,n\} N = { 1 , … , n } be a finite set of players. A weighted majority game is a characteristic function game ( N , v ) (N,v) ( N , v ) for which given weights w 1 , … , w n ∈ R ≥ 0 w_1,\ldots,w_n\in\mathbb{R}_{\ge0} w 1 , … , w n ∈ R ≥ 0 and a quota q > 0 q>0 q > 0 such that, for every coalition S ⊆ N S\subseteq N S ⊆ N ,
v ( S ) = { 1 if ∑ i ∈ S w i ≥ q , 0 otherwise. v(S)=\begin{cases}1 & \text{if }\sum_{i\in S}w_i\ge q,\\0 & \text{otherwise.}\end{cases} v ( S ) = { 1 0 if ∑ i ∈ S w i ≥ q , otherwise.
Combinatorics
We recall some standard combinatorial results used in our analysis.
Lemma B.7 (Pascal’s rule). For any n , k ∈ N > 0 n,k\in\mathbb{N}_{>0} n , k ∈ N > 0 it holds
( n − 1 k ) + ( n − 1 k − 1 ) = ( n k ) , \binom{n-1}{k}+\binom{n-1}{k-1}=\binom{n}{k}, ( k n − 1 ) + ( k − 1 n − 1 ) = ( k n ) , where we assume ( n k ) = 0 \binom{n}{k}=0 ( k n ) = 0 whenever n < k n<k n < k .
Lemma B.8 (Vandermonde’s identity). For any non-negative integers a , b , c ∈ N > 0 a,b,c\in\mathbb{N}_{>0} a , b , c ∈ N > 0 it holds
∑ j = 0 c ( a j ) ( b c − j ) = ( a + b c ) . \sum_{j=0}^{c}\binom{a}{j}\binom{b}{c-j}=\binom{a+b}{c}. j = 0 ∑ c ( j a ) ( c − j b ) = ( c a + b ) .
Definition B.9 (Flajolet and Sedgewick [13 ] , Chapter 1). The ordinary generating function of a sequence { A j } \{A_j\} { A j } is the power series
P ( x ) = ∑ j = 0 ∞ A j x j . P(x)=\sum_{j=0}^{\infty}A_jx^j. P ( x ) = j = 0 ∑ ∞ A j x j . Variable x x x is denoted as the ordinary generating function indeterminate . We denote with [ x ℓ ] P ( x ) [x^\ell]P(x) [ x ℓ ] P ( x ) the operation of extracting the coefficient of x ℓ x^\ell x ℓ in P ( x ) P(x) P ( x ) .
Proofs of main results
Auxiliary technical results
Lemma C.1. Let ( x , y ) (x,y) ( x , y ) be a data point and consider the characteristic function v B v_{\mathrm{B}} v B . Without loss of generality let y = y 1 ∈ Y y=y_1\in\mathcal{Y} y = y 1 ∈ Y . For any classifier C i ∈ C C_i\in\mathcal{C} C i ∈ C , and any coalition S ⊆ C S\subseteq\mathcal{C} S ⊆ C with i ∈ S i\in S i ∈ S and S − i ≠ ∅ S-i\ne\varnothing S − i = ∅ , the marginal gain v B ( S ) − v B ( S − i ) v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i) v B ( S ) − v B ( S − i ) takes values
v B ( S ) − v B ( S − i ) = { 1 2 , if C i ( x ) = y , ( p 1 ( S − i ) = p 2 ( S − i ) ) or ( p 1 ( S − i ) = p 2 ( S − i ) − 1 ) , − 1 2 , if C i ( x ) ≠ y , ( p 1 ( S − i ) = p 2 ( S − i ) ) or ( p 1 ( S − i ) − 1 = p 2 ( S − i ) ) , 0 , otherwise . v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i)=
\begin{cases}
\frac{1}{2}, & \text{if } C_i(x)=y,\ (p_1(S-i)=p_2(S-i))\text{ or }(p_1(S-i)=p_2(S-i)-1),\\
-\frac{1}{2}, & \text{if } C_i(x)\ne y,\ (p_1(S-i)=p_2(S-i))\text{ or }(p_1(S-i)-1=p_2(S-i)),\\
0, & \text{otherwise}.
\end{cases} v B ( S ) − v B ( S − i ) = ⎩ ⎨ ⎧ 2 1 , − 2 1 , 0 , if C i ( x ) = y , ( p 1 ( S − i ) = p 2 ( S − i )) or ( p 1 ( S − i ) = p 2 ( S − i ) − 1 ) , if C i ( x ) = y , ( p 1 ( S − i ) = p 2 ( S − i )) or ( p 1 ( S − i ) − 1 = p 2 ( S − i )) , otherwise . If S − i = ∅ S-i=\varnothing S − i = ∅ then v B ( S ) − v B ( S − i ) v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i) v B ( S ) − v B ( S − i ) is $1$ if C i ( x ) = y C_i(x)=y C i ( x ) = y , and 0 0 0 if $C_i(x)\ne y.
Proof of Lemma C.1. We fix a data point ( x , y = y 1 ) (x,y=y_1) ( x , y = y 1 ) and a classifier C i ∈ C C_i\in\mathcal{C} C i ∈ C . To compute the marginal gain v B ( S ) − v B ( S − i ) v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i) v B ( S ) − v B ( S − i ) , for any S ⊆ C S\subseteq\mathcal{C} S ⊆ C with i ∈ S i\in S i ∈ S , first note that since v B ( ∅ ) = 0 v_{\mathrm{B}}(\varnothing)=0 v B ( ∅ ) = 0 , it follows that if S − i = ∅ S-i=\varnothing S − i = ∅ then v B ( S ) − v B ( S − i ) v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i) v B ( S ) − v B ( S − i ) is 1 1 1 when C i ( x ) = y C_i(x)=y C i ( x ) = y , and it is 0 0 0 when C i ( x ) ≠ y C_i(x)\ne y C i ( x ) = y . Hence we focus on the case S − i ≠ ∅ S-i\ne\varnothing S − i = ∅ .
Correct classifier. (C i ( x ) = y C_i(x)=y C i ( x ) = y ) We distinguish the following cases, which follow from the definition of v B ( ⋅ ) v_{\mathrm{B}}(\cdot) v B ( ⋅ ) , see Eq. (2) :
(i) v B ( S − i ) = 0 v_{\mathrm{B}}(S-i)=0 v B ( S − i ) = 0 , hence p 1 ( S − i ) < p 2 ( S − i ) p_1(S-i)<p_2(S-i) p 1 ( S − i ) < p 2 ( S − i ) ;
(ii) v B ( S − i ) = 1 2 v_{\mathrm{B}}(S-i)=\frac{1}{2} v B ( S − i ) = 2 1 , hence p 1 ( S − i ) = p 2 ( S − i ) p_1(S-i)=p_2(S-i) p 1 ( S − i ) = p 2 ( S − i ) ; and
(iii) v B ( S − i ) = 1 v_{\mathrm{B}}(S-i)=1 v B ( S − i ) = 1 , hence p 1 ( S − i ) > p 2 ( S − i ) p_1(S-i)>p_2(S-i) p 1 ( S − i ) > p 2 ( S − i ) .
Clearly for case (iii) it follows that v B ( S ) = 1 v_{\mathrm{B}}(S)=1 v B ( S ) = 1 , and therefore v B ( S ) − v B ( S − i ) = 0 v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i)=0 v B ( S ) − v B ( S − i ) = 0 . For case (i) it holds that if p 1 ( S − i ) = p 2 ( S − i ) − 1 p_1(S-i)=p_2(S-i)-1 p 1 ( S − i ) = p 2 ( S − i ) − 1 then v B ( S ) = 1 2 v_{\mathrm{B}}(S)=\frac{1}{2} v B ( S ) = 2 1 , otherwise if p 1 ( S − i ) < p 2 ( S − i ) − 1 p_1(S-i)<p_2(S-i)-1 p 1 ( S − i ) < p 2 ( S − i ) − 1 then clearly v B ( S ) = 0 v_{\mathrm{B}}(S)=0 v B ( S ) = 0 . It follows that for case (i) it is v B ( S ) − v B ( S − i ) = 1 2 v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i)=\frac{1}{2} v B ( S ) − v B ( S − i ) = 2 1 if and only if p 1 ( S − i ) = p 2 ( S − i ) − 1 p_1(S-i)=p_2(S-i)-1 p 1 ( S − i ) = p 2 ( S − i ) − 1 . Finally, for case (ii) if v B ( S − i ) = 1 2 v_{\mathrm{B}}(S-i)=\frac{1}{2} v B ( S − i ) = 2 1 it holds that v B ( S ) = 1 v_{\mathrm{B}}(S)=1 v B ( S ) = 1 , proving the first part of the claim.
Incorrect classifier. (C i ( x ) ≠ y C_i(x)\ne y C i ( x ) = y ) The claim follows by a symmetrical argument noting that any classifier i ∈ C i\in\mathcal{C} i ∈ C making an incorrect prediction can only decrease the value of v B ( S − i ) v_{\mathrm{B}}(S-i) v B ( S − i ) , for any S − i ⊆ C S-i\subseteq\mathcal{C} S − i ⊆ C . Specifically,
(i) if v B ( S − i ) = 1 v_{\mathrm{B}}(S-i)=1 v B ( S − i ) = 1 and p 1 ( S − i ) − 1 = p 2 ( S − i ) p_1(S-i)-1=p_2(S-i) p 1 ( S − i ) − 1 = p 2 ( S − i ) , then v B ( S ) = 1 2 v_{\mathrm{B}}(S)=\frac{1}{2} v B ( S ) = 2 1 , thus v B ( S ) − v B ( S − i ) = − 1 2 v_{\mathrm{B}}(S)-v_{\mathrm{B}}(S-i)=-\frac{1}{2} v B ( S ) − v B ( S − i ) = − 2 1 .
(ii) If v B ( S − i ) = 1 2 v_{\mathrm{B}}(S-i)=\frac{1}{2} v B ( S − i ) = 2 1 then p 1 ( S − i ) = p 2 ( S − i ) p_1(S-i)=p_2(S-i) p 1 ( S − i ) = p 2 ( S − i ) . Hence, a classifier i i i making an incorrect prediction breaks the tie negatively, so v B ( S ) = 0 v_{\mathrm{B}}(S)=0 v B ( S ) = 0 , yielding a marginal contribution of − 1 2 -\frac{1}{2} − 2 1 .
(iii) In all other cases, the characteristic function value does not change, yielding a marginal contribution of 0 0 0 .
Lemma C.2. Let ( x , y ) (x,y) ( x , y ) be a data point and consider the characteristic function v M C v_{\mathrm{MC}} v MC . Without loss of generality let y = y 1 ∈ Y y=y_1\in\mathcal{Y} y = y 1 ∈ Y . For any classifier C i ∈ C C_i\in\mathcal{C} C i ∈ C with C i ( x ) = y C_i(x)=y C i ( x ) = y , and any coalition S ⊆ C S\subseteq\mathcal{C} S ⊆ C with i ∈ S i\in S i ∈ S and S − i ≠ ∅ S-i\ne\varnothing S − i = ∅ , the marginal gain v M C ( S ) − v M C ( S − i ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) v MC ( S ) − v MC ( S − i ) takes values
v M C ( S ) − v M C ( S − i ) = { 1 ∣ M ( S − i ) ∣ + 1 , if ∣ M ( S − i ) ∣ > 0 and p 1 ( S − i ) = p j ( S − i ) − 1 , for each j ∈ M ( S − i ) , 1 ∣ M ( S − i ) ∣ − 1 , if ∣ M ( S − i ) ∣ > 1 and p 1 ( S − i ) = p j ( S − i ) , for each j ∈ M ( S − i ) , 0 , otherwise . v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=
\begin{cases}
\frac{1}{|\mathcal{M}(S-i)|+1}, & \text{if }|\mathcal{M}(S-i)|>0\text{ and }p_1(S-i)=p_j(S-i)-1,\text{ for each }j\in\mathcal{M}(S-i),\\
\frac{1}{|\mathcal{M}(S-i)|-1}, & \text{if }|\mathcal{M}(S-i)|>1\text{ and }p_1(S-i)=p_j(S-i),\text{ for each }j\in\mathcal{M}(S-i),\\
0, & \text{otherwise}.
\end{cases} v MC ( S ) − v MC ( S − i ) = ⎩ ⎨ ⎧ ∣ M ( S − i ) ∣ + 1 1 , ∣ M ( S − i ) ∣ − 1 1 , 0 , if ∣ M ( S − i ) ∣ > 0 and p 1 ( S − i ) = p j ( S − i ) − 1 , for each j ∈ M ( S − i ) , if ∣ M ( S − i ) ∣ > 1 and p 1 ( S − i ) = p j ( S − i ) , for each j ∈ M ( S − i ) , otherwise . On the other hand, for any C i ∈ C C_i\in\mathcal{C} C i ∈ C with C i ( x ) = y j C_i(x)=y_j C i ( x ) = y j , where y j ≠ y 1 y_j\ne y_1 y j = y 1 , and any coalition S ⊆ C S\subseteq\mathcal{C} S ⊆ C with i ∈ S i\in S i ∈ S and S − i ≠ ∅ S-i\ne\varnothing S − i = ∅ , the marginal gain v M C ( S ) − v M C ( S − i ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) v MC ( S ) − v MC ( S − i ) takes values
v M C ( S ) − v M C ( S − i ) = { − 1 ∣ M ( S − i ) ∣ , if p j ( S − i ) = p j ′ ( S − i ) , for each j ′ ∈ M ( S − i ) and 1 ∈ M ( S − i ) , 1 ∣ M ( S − i ) ∣ ( ∣ M ( S − i ) ∣ + 1 ) , if p j ( S − i ) = p j ′ ( S − i ) − 1 , for each j ′ ∈ M ( S − i ) and 1 ∈ M ( S − i ) , 0 , otherwise . v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=
\begin{cases}
-\frac{1}{|\mathcal{M}(S-i)|}, & \text{if }p_j(S-i)=p_{j'}(S-i),\text{ for each }j'\in\mathcal{M}(S-i)\text{ and }1\in\mathcal{M}(S-i),\\
\frac{1}{|\mathcal{M}(S-i)|\bigl(|\mathcal{M}(S-i)|+1\bigr)}, & \text{if }p_j(S-i)=p_{j'}(S-i)-1,\text{ for each }j'\in\mathcal{M}(S-i)\text{ and }1\in\mathcal{M}(S-i),\\
0, & \text{otherwise}.
\end{cases} v MC ( S ) − v MC ( S − i ) = ⎩ ⎨ ⎧ − ∣ M ( S − i ) ∣ 1 , ∣ M ( S − i ) ∣ ( ∣ M ( S − i ) ∣ + 1 ) 1 , 0 , if p j ( S − i ) = p j ′ ( S − i ) , for each j ′ ∈ M ( S − i ) and 1 ∈ M ( S − i ) , if p j ( S − i ) = p j ′ ( S − i ) − 1 , for each j ′ ∈ M ( S − i ) and 1 ∈ M ( S − i ) , otherwise . Finally, if S − i = ∅ S-i=\varnothing S − i = ∅ , then v M C ( S ) − v M C ( S − i ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) v MC ( S ) − v MC ( S − i ) is 1 1 1 if C i ( x ) = y C_i(x)=y C i ( x ) = y , and it is 0 0 0 if C i ( x ) ≠ y C_i(x)\ne y C i ( x ) = y .
Proof of Lemma C.2. We fix a data point ( x , y = y 1 ) (x,y=y_1) ( x , y = y 1 ) and a classifier C i ∈ C C_i\in\mathcal{C} C i ∈ C . We compute the marginal gain v M C ( S ) − v M C ( S − i ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) v MC ( S ) − v MC ( S − i ) for any S ⊆ C S\subseteq\mathcal{C} S ⊆ C with i ∈ S i\in S i ∈ S . First note that since v M C ( ∅ ) = 0 v_{\mathrm{MC}}(\varnothing)=0 v MC ( ∅ ) = 0 , if S − i = ∅ S-i=\varnothing S − i = ∅ then v M C ( S ) − v M C ( S − i ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) v MC ( S ) − v MC ( S − i ) is 1 1 1 when C i ( x ) = y C_i(x)=y C i ( x ) = y , and it is 0 0 0 when C i ( x ) ≠ y C_i(x)\ne y C i ( x ) = y . Hence we focus on the case S − i ≠ ∅ S-i\ne\varnothing S − i = ∅ .
We distinguish the following cases, which follow from the definition of v M C ( ⋅ ) v_{\mathrm{MC}}(\cdot) v MC ( ⋅ ) , see Eq. (3) :
v M C ( S − i ) = 0 v_{\mathrm{MC}}(S-i)=0 v MC ( S − i ) = 0 , hence p 1 ( S − i ) < p j ( S − i ) p_1(S-i)<p_j(S-i) p 1 ( S − i ) < p j ( S − i ) for j ∈ M ( S − i ) j\in\mathcal{M}(S-i) j ∈ M ( S − i ) ;
v M C ( S − i ) = 1 / ∣ M ( S − i ) ∣ v_{\mathrm{MC}}(S-i)=1/\lvert\mathcal{M}(S-i)\rvert v MC ( S − i ) = 1/ ∣ M ( S − i )∣ , hence p 1 ( S − i ) = p j ( S − i ) p_1(S-i)=p_j(S-i) p 1 ( S − i ) = p j ( S − i ) for j ∈ M ( S − i ) j\in\mathcal{M}(S-i) j ∈ M ( S − i ) , ∣ M ( S − i ) ∣ ≥ 1 \lvert\mathcal{M}(S-i)\rvert\ge1 ∣ M ( S − i )∣ ≥ 1 ;
Correct classifier. (C i ( x ) = y C_i(x)=y C i ( x ) = y ) We first consider case (i) for which 1 ∉ M ( S − i ) 1\notin\mathcal{M}(S-i) 1 ∈ / M ( S − i ) . Note that p 1 ( S ) = p 1 ( S − i ) + 1 p_1(S)=p_1(S-i)+1 p 1 ( S ) = p 1 ( S − i ) + 1 and hence if p 1 ( S − i ) + 1 < p j ( S − i ) = p j ( S ) p_1(S-i)+1<p_j(S-i)=p_j(S) p 1 ( S − i ) + 1 < p j ( S − i ) = p j ( S ) then v M C ( S ) = 0 v_{\mathrm{MC}}(S)=0 v MC ( S ) = 0 and therefore v M C ( S ) − v M C ( S − i ) = 0 v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=0 v MC ( S ) − v MC ( S − i ) = 0 . Thus, it holds v M C ( S ) − v M C ( S − i ) ≠ 0 v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)\ne0 v MC ( S ) − v MC ( S − i ) = 0 if and only if p 1 ( S − i ) + 1 = p j ( S − i ) p_1(S-i)+1=p_j(S-i) p 1 ( S − i ) + 1 = p j ( S − i ) for each j ∈ M ( S − i ) j\in\mathcal{M}(S-i) j ∈ M ( S − i ) . Therefore v M C ( S ) = 1 / ( ∣ M ( S − i ) ∣ + 1 ) v_{\mathrm{MC}}(S)=1/(\lvert\mathcal{M}(S-i)\rvert+1) v MC ( S ) = 1/ (∣ M ( S − i )∣ + 1 ) and in turn v M C ( S ) − v M C ( S − i ) = 1 / ( ∣ M ( S − i ) ∣ + 1 ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=1/(\lvert\mathcal{M}(S-i)\rvert+1) v MC ( S ) − v MC ( S − i ) = 1/ (∣ M ( S − i )∣ + 1 ) .
For case (ii) note first that p j ( S ) = p j ( S − i ) p_j(S)=p_j(S-i) p j ( S ) = p j ( S − i ) for each j ≥ 2 j\ge2 j ≥ 2 , since C i ( x ) = y C_i(x)=y C i ( x ) = y . Hence, for each j ∈ M ( S − i ) j\in\mathcal{M}(S-i) j ∈ M ( S − i ) , j ≥ 2 j\ge2 j ≥ 2 , it holds p 1 ( S ) = p 1 ( S − i ) + 1 = p j ( S − i ) + 1 > p j ( S ) p_1(S)=p_1(S-i)+1=p_j(S-i)+1>p_j(S) p 1 ( S ) = p 1 ( S − i ) + 1 = p j ( S − i ) + 1 > p j ( S ) , and this also holds for each j ∉ M ( S − i ) j\notin\mathcal{M}(S-i) j ∈ / M ( S − i ) , j ≥ 2 j\ge2 j ≥ 2 , that is p j ( S − i ) < p 1 ( S − i ) p_j(S-i)<p_1(S-i) p j ( S − i ) < p 1 ( S − i ) . Therefore M ( S ) = { 1 } \mathcal{M}(S)=\{1\} M ( S ) = { 1 } and v M C ( S ) = 1 v_{\mathrm{MC}}(S)=1 v MC ( S ) = 1 . Note that it must be that ∣ M ( S − i ) ∣ > 1 \lvert\mathcal{M}(S-i)\rvert>1 ∣ M ( S − i )∣ > 1 otherwise if ∣ M ( S − i ) ∣ = 1 \lvert\mathcal{M}(S-i)\rvert=1 ∣ M ( S − i )∣ = 1 then v M C ( S ) = v M C ( S − i ) v_{\mathrm{MC}}(S)=v_{\mathrm{MC}}(S-i) v MC ( S ) = v MC ( S − i ) , yielding no marginal gain for the addition of i i i to S − i S-i S − i . Therefore, we have that v M C ( S ) − v M C ( S − i ) = 1 − 1 / ∣ M ( S − i ) ∣ v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=1-1/\lvert\mathcal{M}(S-i)\rvert v MC ( S ) − v MC ( S − i ) = 1 − 1/ ∣ M ( S − i )∣ . This yields the claim for correct classifiers.
Incorrect classifier. (C i ( x ) = y j C_i(x)=y_j C i ( x ) = y j , j ≥ 2 j\ge2 j ≥ 2 ) For case (i) we have that p 1 ( S ) = p 1 ( S − i ) p_1(S)=p_1(S-i) p 1 ( S ) = p 1 ( S − i ) , since C i ( x ) ≠ y 1 C_i(x)\ne y_1 C i ( x ) = y 1 , while max j ′ ∈ [ ℓ ] p j ′ ( S ) ≥ max j ′ ∈ [ ℓ ] p j ′ ( S − i ) > p 1 ( S − i ) \max_{j'\in[\ell]}p_{j'}(S)\ge\max_{j'\in[\ell]}p_{j'}(S-i)>p_1(S-i) max j ′ ∈ [ ℓ ] p j ′ ( S ) ≥ max j ′ ∈ [ ℓ ] p j ′ ( S − i ) > p 1 ( S − i ) , where the last inequality is the defining property of case (i). Hence 1 ∉ M ( S ) 1\notin\mathcal{M}(S) 1 ∈ / M ( S ) , and therefore v M C ( S ) = 0 = v M C ( S − i ) v_{\mathrm{MC}}(S)=0=v_{\mathrm{MC}}(S-i) v MC ( S ) = 0 = v MC ( S − i ) . That is, for case (i) it holds that v M C ( S ) − v M C ( S − i ) = 0 v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=0 v MC ( S ) − v MC ( S − i ) = 0 .
For case (ii) we distinguish the following two sub-cases
p j ( S − i ) = p j ′ ( S − i ) p_j(S-i)=p_{j'}(S-i) p j ( S − i ) = p j ′ ( S − i ) for each j ′ ∈ M ( S − i ) j'\in\mathcal{M}(S-i) j ′ ∈ M ( S − i ) and 1 ∈ M ( S − i ) 1\in\mathcal{M}(S-i) 1 ∈ M ( S − i ) ;
p j ( S − i ) = p j ′ ( S − i ) − 1 p_j(S-i)=p_{j'}(S-i)-1 p j ( S − i ) = p j ′ ( S − i ) − 1 for each j ′ ∈ M ( S − i ) j'\in\mathcal{M}(S-i) j ′ ∈ M ( S − i ) and 1 ∈ M ( S − i ) 1\in\mathcal{M}(S-i) 1 ∈ M ( S − i ) .
For (ii.a) first note that v M C ( S − i ) = 1 / ∣ M ( S − i ) ∣ v_{\mathrm{MC}}(S-i)=1/\lvert\mathcal{M}(S-i)\rvert v MC ( S − i ) = 1/ ∣ M ( S − i )∣ by Eq. (3) . Thus, p j ( S ) = p j ( S − i ) + 1 > p j ′ ( S − i ) p_j(S)=p_j(S-i)+1>p_{j'}(S-i) p j ( S ) = p j ( S − i ) + 1 > p j ′ ( S − i ) for each j ′ ∈ M ( S − i ) j'\in\mathcal{M}(S-i) j ′ ∈ M ( S − i ) , implying v M C ( S ) = 0 v_{\mathrm{MC}}(S)=0 v MC ( S ) = 0 and therefore v M C ( S ) − v M C ( S − i ) = 0 − 1 / ∣ M ( S − i ) ∣ = − 1 / ∣ M ( S − i ) ∣ v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=0-1/\lvert\mathcal{M}(S-i)\rvert=-1/\lvert\mathcal{M}(S-i)\rvert v MC ( S ) − v MC ( S − i ) = 0 − 1/ ∣ M ( S − i )∣ = − 1/ ∣ M ( S − i )∣ .
For (ii.b) it holds v M C ( S − i ) = 1 / ∣ M ( S − i ) ∣ v_{\mathrm{MC}}(S-i)=1/\lvert\mathcal{M}(S-i)\rvert v MC ( S − i ) = 1/ ∣ M ( S − i )∣ . Since p j ( S − i ) = p j ′ ( S − i ) − 1 p_j(S-i)=p_{j'}(S-i)-1 p j ( S − i ) = p j ′ ( S − i ) − 1 we have that p j ( S ) = p j ( S − i ) + 1 = p j ′ ( S − i ) p_j(S)=p_j(S-i)+1=p_{j'}(S-i) p j ( S ) = p j ( S − i ) + 1 = p j ′ ( S − i ) and therefore j ∉ M ( S − i ) j\notin\mathcal{M}(S-i) j ∈ / M ( S − i ) while j ∈ M ( S ) j\in\mathcal{M}(S) j ∈ M ( S ) . This implies that v M C ( S ) = 1 / ( 1 + ∣ M ( S − i ) ∣ ) v_{\mathrm{MC}}(S)=1/(1+\lvert\mathcal{M}(S-i)\rvert) v MC ( S ) = 1/ ( 1 + ∣ M ( S − i )∣) and therefore v M C ( S ) − v M C ( S − i ) = 1 / ( 1 + ∣ M ( S − i ) ∣ ) − 1 / ∣ M ( S − i ) ∣ = − 1 / ( ∣ M ( S − i ) ∣ ( 1 + ∣ M ( S − i ) ∣ ) ) v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i)=1/(1+\lvert\mathcal{M}(S-i)\rvert)-1/\lvert\mathcal{M}(S-i)\rvert=-1/(\lvert\mathcal{M}(S-i)\rvert(1+\lvert\mathcal{M}(S-i)\rvert)) v MC ( S ) − v MC ( S − i ) = 1/ ( 1 + ∣ M ( S − i )∣) − 1/ ∣ M ( S − i )∣ = − 1/ (∣ M ( S − i )∣ ( 1 + ∣ M ( S − i )∣)) .
Finally, it is sufficient to observe that in all other cases where 1 ∉ M ( S − i ) 1\notin\mathcal{M}(S-i) 1 ∈ / M ( S − i ) the addition of i i i can never alter the value of v M C ( S − i ) v_{\mathrm{MC}}(S-i) v MC ( S − i ) . Similarly, if 1 ∈ M ( S − i ) 1\in\mathcal{M}(S-i) 1 ∈ M ( S − i ) and p j ′ ( S − i ) − p j ( S − i ) ≥ 2 p_{j'}(S-i)-p_j(S-i)\ge2 p j ′ ( S − i ) − p j ( S − i ) ≥ 2 for j ′ ∈ M ( S − i ) j'\in\mathcal{M}(S-i) j ′ ∈ M ( S − i ) , then p j ( S ) = p j ( S − i ) + 1 < p j ′ ( S − i ) p_j(S)=p_j(S-i)+1<p_{j'}(S-i) p j ( S ) = p j ( S − i ) + 1 < p j ′ ( S − i ) , thus M ( S ) = M ( S − i ) \mathcal{M}(S)=\mathcal{M}(S-i) M ( S ) = M ( S − i ) and the addition of i i i yields v M C ( S ) = v M C ( S − i ) v_{\mathrm{MC}}(S)=v_{\mathrm{MC}}(S-i) v MC ( S ) = v MC ( S − i ) . Since p j ′ ( S − i ) = max h ∈ [ ℓ ] p h ( S − i ) p_{j'}(S-i)=\max_{h\in[\ell]}p_h(S-i) p j ′ ( S − i ) = max h ∈ [ ℓ ] p h ( S − i ) for j ′ ∈ M ( S − i ) j'\in\mathcal{M}(S-i) j ′ ∈ M ( S − i ) , our case split for p j ′ ( S − i ) − p j ( S − i ) p_{j'}(S-i)-p_j(S-i) p j ′ ( S − i ) − p j ( S − i ) in { 0 , 1 , ≥ 2 } \{0,1,\ge2\} { 0 , 1 , ≥ 2 } is exhaustive, which proves the claim for an incorrect classifier and concludes the proof. □
Proofs of sec:prelim
Lemma C.3 (Restatement of Lemma 3.3). The characteristic function v B : 2 C → { 0 , 1 2 , 1 } v_{\mathrm{B}}:2^{\mathcal{C}}\to\{0,\frac{1}{2},1\} v B : 2 C → { 0 , 2 1 , 1 } is
(i) neither supermodular;
(ii) nor superadditive;
(iii) nor monotone.
Proof. We prove the lemma by providing counterexamples. Consider an ensemble C = { C 1 , … , C 5 } \mathcal{C}=\{C_1,\ldots,C_5\} C = { C 1 , … , C 5 } with 5 5 5 classifiers. Fix a data-point z = ( x , 1 ) z=(x,1) z = ( x , 1 ) and let C 1 ( x ) = C 2 ( x ) = C 3 ( x ) = C 4 ( x ) = 0 C_1(x)=C_2(x)=C_3(x)=C_4(x)=0 C 1 ( x ) = C 2 ( x ) = C 3 ( x ) = C 4 ( x ) = 0 . Fix the coalition S = { C 1 , … , C 4 } S=\{C_1,\ldots,C_4\} S = { C 1 , … , C 4 } . Clearly, v B ( S ) = 1 2 v_{\mathrm{B}}(S)=\frac{1}{2} v B ( S ) = 2 1 . Let S 1 = { C 1 , C 2 } S_1=\{C_1,C_2\} S 1 = { C 1 , C 2 } and S 2 = { C 3 , C 4 } S_2=\{C_3,C_4\} S 2 = { C 3 , C 4 } , and note that S 1 ∩ S 2 = ∅ S_1\cap S_2=\varnothing S 1 ∩ S 2 = ∅ . Further, let { C 3 } = S 3 ⊆ S 4 = { C 1 , C 2 , C 3 } \{C_3\}=S_3\subseteq S_4=\{C_1,C_2,C_3\} { C 3 } = S 3 ⊆ S 4 = { C 1 , C 2 , C 3 } . We have:
(i) 1 − 1 = v B ( S 4 ∪ { C 5 } ) − v B ( S 4 ) < v B ( S 3 ∪ { C 5 } ) − v B ( S 3 ) = 1 2 − 0 1-1=v_{\mathrm{B}}(S_4\cup\{C_5\})-v_{\mathrm{B}}(S_4)<v_{\mathrm{B}}(S_3\cup\{C_5\})-v_{\mathrm{B}}(S_3)=\frac{1}{2}-0 1 − 1 = v B ( S 4 ∪ { C 5 }) − v B ( S 4 ) < v B ( S 3 ∪ { C 5 }) − v B ( S 3 ) = 2 1 − 0 ;
(ii) 1 2 = v B ( S ) = v B ( S 1 ∪ S 2 ) < v B ( S 1 ) + v B ( S 2 ) = 1 + 0 \frac{1}{2}=v_{\mathrm{B}}(S)=v_{\mathrm{B}}(S_1\cup S_2)<v_{\mathrm{B}}(S_1)+v_{\mathrm{B}}(S_2)=1+0 2 1 = v B ( S ) = v B ( S 1 ∪ S 2 ) < v B ( S 1 ) + v B ( S 2 ) = 1 + 0 ;
::: (iii) 1 2 = v B ( S ) < v B ( S 1 ) = 1 \frac{1}{2}=v_{\mathrm{B}}(S)<v_{\mathrm{B}}(S_1)=1 2 1 = v B ( S ) < v B ( S 1 ) = 1 .
Corollary C.4. The characteristic function game G = ( C , v B ) G=(\mathcal{C},v_{\mathrm{B}}) G = ( C , v B ) is non-convex.
Proof of Corollary C.4. It is a well-known result in cooperative game theory that a game G = ( N , v ) G=(N,v) G = ( N , v ) is convex if and only if its characteristic function v v v is supermodular [39 ] .
Proofs of subsec:binClass
Proof of Theorem 4.1. Fix a test data point z = ( x , y ) ∈ D z=(x,y)\in\mathcal{D} z = ( x , y ) ∈ D and, without loss of generality, let y = y 1 y=y_1 y = y 1 . Expressing the summation in Def. 3.2 over the subsets of C − i \mathcal{C}-i C − i , the Banzhaf value of a classifier i ∈ [ n ] i\in[n] i ∈ [ n ] corresponds to
β i ( G z ) = 1 2 n − 1 ∑ S ⊆ C − i ( v B ( S + i ) − v B ( S ) ) = E S [ v B ( S + i ) − v B ( S ) ] . \beta_i(G_z)=\frac{1}{2^{n-1}}\sum_{S\subseteq\mathcal{C}-i}\left(v_{\mathrm{B}}(S+i)-v_{\mathrm{B}}(S)\right)=\mathbb{E}_S\left[v_{\mathrm{B}}(S+i)-v_{\mathrm{B}}(S)\right]. β i ( G z ) = 2 n − 1 1 S ⊆ C − i ∑ ( v B ( S + i ) − v B ( S ) ) = E S [ v B ( S + i ) − v B ( S ) ] .
where S S S is a uniformly random subset of C − i \mathcal{C}-i C − i . That is, each classifier j ∈ C − i j\in\mathcal{C}-i j ∈ C − i is included in S S S independently with probability 1 / 2 1/2 1/2 . Let n + ( S ) ≔ ∣ { j ∈ S : C j ( x ) = y } ∣ n_+(S)\coloneqq|\{j\in S:C_j(x)=y\}| n + ( S ) : = ∣ { j ∈ S : C j ( x ) = y } ∣ and n − ( S ) ≔ ∣ { j ∈ S : C j ( x ) ≠ y } ∣ n_-(S)\coloneqq|\{j\in S:C_j(x)\ne y\}| n − ( S ) : = ∣ { j ∈ S : C j ( x ) = y } ∣ be the number of correct and of incorrect classifiers in S S S . Recall n + n_+ n + and n − n_- n − corresponds to the number of correct and incorrect classifiers in C \mathcal{C} C . Furthermore, we have p 1 ( S ) = n + ( S ) p_1(S)=n_+(S) p 1 ( S ) = n + ( S ) and p 2 ( S ) = n − ( S ) p_2(S)=n_-(S) p 2 ( S ) = n − ( S ) . Note that the random variables n + ( S ) n_+(S) n + ( S ) and n − ( S ) n_-(S) n − ( S ) are independent, since a model is either correct or not. Recall that we use the convention ( m k ) = 0 \binom{m}{k}=0 ( k m ) = 0 for k < 0 k<0 k < 0 or k > m k>m k > m .
Correct classifier. (C i ( x ) = y C_i(x)=y C i ( x ) = y ) The set C − i \mathcal{C}-i C − i contains n + − 1 n_+-1 n + − 1 correct and n − n_- n − incorrect classifiers, thus n + ( S ) ∼ Bin ( n + − 1 , 1 / 2 ) n_+(S)\sim\operatorname{Bin}(n_+-1,1/2) n + ( S ) ∼ Bin ( n + − 1 , 1/2 ) and n − ( S ) ∼ Bin ( n − , 1 / 2 ) n_-(S)\sim\operatorname{Bin}(n_-,1/2) n − ( S ) ∼ Bin ( n − , 1/2 ) . By Lemma C.1 , for S ≠ ∅ S\ne\varnothing S = ∅ the marginal gain of i i i is 1 / 2 1/2 1/2 if n − ( S ) − n + ( S ) ∈ { 0 , 1 } n_-(S)-n_+(S)\in\{0,1\} n − ( S ) − n + ( S ) ∈ { 0 , 1 } and it is 0 0 0 otherwise, while for S = ∅ S=\varnothing S = ∅ it is 1 1 1 . Since, conditioning on S = ∅ S=\varnothing S = ∅ it holds n − ( S ) − n + ( S ) = 0 n_-(S)-n_+(S)=0 n − ( S ) − n + ( S ) = 0 , we have that for every S ⊆ C − i S\subseteq\mathcal{C}-i S ⊆ C − i ,
v B ( S + i ) − v B ( S ) = 1 2 1 [ n − ( S ) − n + ( S ) ∈ { 0 , 1 } ] + 1 2 1 [ S = ∅ ] . v_{\mathrm{B}}(S+i)-v_{\mathrm{B}}(S)=\frac{1}{2}\mathbf{1}[n_-(S)-n_+(S)\in\{0,1\}]+\frac{1}{2}\mathbf{1}[S=\varnothing]. v B ( S + i ) − v B ( S ) = 2 1 1 [ n − ( S ) − n + ( S ) ∈ { 0 , 1 }] + 2 1 1 [ S = ∅ ] .
Thus,
β i ( G z ) = 1 2 Pr [ n − ( S ) = n + ( S ) ] + 1 2 Pr [ n − ( S ) = n + ( S ) + 1 ] + 1 2 Pr [ S = ∅ ] , (6) \beta_i(G_z)=\frac{1}{2}\Pr[n_-(S)=n_+(S)]+\frac{1}{2}\Pr[n_-(S)=n_+(S)+1]+\frac{1}{2}\Pr[S=\varnothing], \tag*{(6)} β i ( G z ) = 2 1 Pr [ n − ( S ) = n + ( S )] + 2 1 Pr [ n − ( S ) = n + ( S ) + 1 ] + 2 1 Pr [ S = ∅ ] , (6)
by taking the expectation over S S S . We now compute the three terms separately.
Pr [ n − ( S ) = n + ( S ) ] = ∑ k ≥ 0 Pr [ n + ( S ) = k ] Pr [ n − ( S ) = k ] = ∑ k ≥ 0 ( n + − 1 k ) ( n − k ) ( 1 2 ) n + − 1 + n − = 1 2 n − 1 ∑ k ≥ 0 ( n + − 1 k ) ( n − n − − k ) = 1 2 n − 1 ( n − 1 n − ) . \begin{aligned}
\Pr[n_-(S)=n_+(S)]&=\sum_{k\ge0}\Pr[n_+(S)=k]\Pr[n_-(S)=k]\\
&=\sum_{k\ge0}\binom{n_+-1}{k}\binom{n_-}{k}\left(\frac{1}{2}\right)^{n_+-1+n_-}\\
&=\frac{1}{2^{n-1}}\sum_{k\ge0}\binom{n_+-1}{k}\binom{n_-}{n_--k}
=\frac{1}{2^{n-1}}\binom{n-1}{n_-}.
\end{aligned} Pr [ n − ( S ) = n + ( S )] = k ≥ 0 ∑ Pr [ n + ( S ) = k ] Pr [ n − ( S ) = k ] = k ≥ 0 ∑ ( k n + − 1 ) ( k n − ) ( 2 1 ) n + − 1 + n − = 2 n − 1 1 k ≥ 0 ∑ ( k n + − 1 ) ( n − − k n − ) = 2 n − 1 1 ( n − n − 1 ) .
The first equality uses the independence of n + ( S ) n_+(S) n + ( S ) and n − ( S ) n_-(S) n − ( S ) . The second one uses that both n + ( S ) n_+(S) n + ( S ) and n − ( S ) n_-(S) n − ( S ) are binomial random variables with parameter 1 / 2 1/2 1/2 . The third equality follows by n + + n − = n n_++n_-=n n + + n − = n and the symmetry of the binomial coefficients, i.e., ( a k ) = ( a a − k ) \binom{a}{k}=\binom{a}{a-k} ( k a ) = ( a − k a ) . Finally, the last equality uses the Vandermonde’s identity (Lemma B.8 ) with a = n + − 1 a=n_+-1 a = n + − 1 , b = n − b=n_- b = n − and c = n − c=n_- c = n − . The second term of Eq. (6) is obtained analogously,
Pr [ n − ( S ) = n + ( S ) + 1 ] = ∑ k ≥ 0 Pr [ n + ( S ) = k ] Pr [ n − ( S ) = k + 1 ] = 1 2 n − 1 ∑ k ≥ 0 ( n + − 1 k ) ( n − k + 1 ) = 1 2 n − 1 ∑ k ≥ 0 ( n + − 1 k ) ( n − n − − 1 − k ) = 1 2 n − 1 ( n − 1 n − − 1 ) , \begin{aligned}
\Pr[n_-(S)=n_+(S)+1]&=\sum_{k\ge0}\Pr[n_+(S)=k]\Pr[n_-(S)=k+1]\\
&=\frac{1}{2^{n-1}}\sum_{k\ge0}\binom{n_+-1}{k}\binom{n_-}{k+1}\\
&=\frac{1}{2^{n-1}}\sum_{k\ge0}\binom{n_+-1}{k}\binom{n_-}{n_--1-k}
=\frac{1}{2^{n-1}}\binom{n-1}{n_--1},
\end{aligned} Pr [ n − ( S ) = n + ( S ) + 1 ] = k ≥ 0 ∑ Pr [ n + ( S ) = k ] Pr [ n − ( S ) = k + 1 ] = 2 n − 1 1 k ≥ 0 ∑ ( k n + − 1 ) ( k + 1 n − ) = 2 n − 1 1 k ≥ 0 ∑ ( k n + − 1 ) ( n − − 1 − k n − ) = 2 n − 1 1 ( n − − 1 n − 1 ) ,
where the last equality follows by Vandermonde’s identity with a = n + − 1 a=n_{+}-1 a = n + − 1 , b = n − b=n_{-} b = n − and c = n − − 1 c=n_{-}-1 c = n − − 1 . The third term of Eq. (6) corresponds to Pr [ S = ∅ ] = 2 − ( n − 1 ) \Pr[S=\varnothing]=2^{-(n-1)} Pr [ S = ∅ ] = 2 − ( n − 1 ) , since S S S is a uniformly random subset of the n − 1 n-1 n − 1 classifiers in C − i \mathcal{C}-i C − i . Combining all three terms above with Eq. (6) we have
β i ( G z ) = 1 2 n ( ( n − 1 n − ) + ( n − 1 n − − 1 ) ) + 1 2 n = 1 2 n ( ( n n − ) + 1 ) . \beta_i(G_z)=\frac{1}{2^n}\left(\binom{n-1}{n_{-}}+\binom{n-1}{n_{-}-1}\right)+\frac{1}{2^n}=\frac{1}{2^n}\left(\binom{n}{n_{-}}+1\right). β i ( G z ) = 2 n 1 ( ( n − n − 1 ) + ( n − − 1 n − 1 ) ) + 2 n 1 = 2 n 1 ( ( n − n ) + 1 ) .
where we used Pascal’s rule (Lemma B.7), which yields the first part of the claim.
Incorrect classifier. (C i ( x ) ≠ y C_i(x)\ne y C i ( x ) = y ) The set C − i \mathcal{C}-i C − i contains n + n_{+} n + correct and n − − 1 n_{-}-1 n − − 1 incorrect classifiers, hence n + ( S ) ∼ Bin ( n + , 1 / 2 ) n_{+}(S)\sim\operatorname{Bin}(n_{+},1/2) n + ( S ) ∼ Bin ( n + , 1/2 ) and n − ( S ) ∼ Bin ( n − − 1 , 1 / 2 ) n_{-}(S)\sim\operatorname{Bin}(n_{-}-1,1/2) n − ( S ) ∼ Bin ( n − − 1 , 1/2 ) . By Lemma C.1, for S ≠ ∅ S\ne\varnothing S = ∅ the marginal gain of i i i is − 1 2 -\frac{1}{2} − 2 1 if n + ( S ) − n − ( S ) ∈ { 0 , 1 } n_{+}(S)-n_{-}(S)\in\{0,1\} n + ( S ) − n − ( S ) ∈ { 0 , 1 } and it is 0 0 0 otherwise, while for S = ∅ S=\varnothing S = ∅ it is 0 0 0 . Hence, for every S ⊆ C − i S\subseteq\mathcal{C}-i S ⊆ C − i ,
v B ( S + i ) − v B ( S ) = − 1 2 1 [ n + ( S ) − n − ( S ) ∈ { 0 , 1 } ] + 1 2 1 [ S = ∅ ] , v_B(S+i)-v_B(S)=-\frac{1}{2}\mathbf{1}[n_{+}(S)-n_{-}(S)\in\{0,1\}]+\frac{1}{2}\mathbf{1}[S=\varnothing], v B ( S + i ) − v B ( S ) = − 2 1 1 [ n + ( S ) − n − ( S ) ∈ { 0 , 1 }] + 2 1 1 [ S = ∅ ] ,
where the last term accounts for the correction of the marginal gain over S = ∅ S=\varnothing S = ∅ . Thus
β i ( G z ) = − 1 2 Pr [ n + ( S ) = n − ( S ) ] − 1 2 Pr [ n + ( S ) = n − ( S ) + 1 ] + 1 2 n , \beta_i(G_z)=-\frac{1}{2}\Pr[n_{+}(S)=n_{-}(S)]-\frac{1}{2}\Pr[n_{+}(S)=n_{-}(S)+1]+\frac{1}{2^n}, β i ( G z ) = − 2 1 Pr [ n + ( S ) = n − ( S )] − 2 1 Pr [ n + ( S ) = n − ( S ) + 1 ] + 2 n 1 ,
by taking the expectation over S S S . The two probabilities in the above sum follow from the computations of the previous case, by simply exchanging the roles of correct and of incorrect classifiers. That is, it is sufficient to replace n + − 1 n_{+}-1 n + − 1 with n − − 1 n_{-}-1 n − − 1 and n − n_{-} n − with n + n_{+} n + . Therefore
Pr [ n + ( S ) = n − ( S ) ] = 1 2 n − 1 ( n − 1 n + ) , Pr [ n + ( S ) = n − ( S ) + 1 ] = 1 2 n − 1 ( n − 1 n + − 1 ) . \Pr[n_{+}(S)=n_{-}(S)]=\frac{1}{2^{n-1}}\binom{n-1}{n_{+}},\qquad\Pr[n_{+}(S)=n_{-}(S)+1]=\frac{1}{2^{n-1}}\binom{n-1}{n_{+}-1}. Pr [ n + ( S ) = n − ( S )] = 2 n − 1 1 ( n + n − 1 ) , Pr [ n + ( S ) = n − ( S ) + 1 ] = 2 n − 1 1 ( n + − 1 n − 1 ) .
Combining the above we have
β i ( G z ) = − 1 2 n ( n n + ) + 1 2 n = − 1 2 n ( ( n n + ) − 1 ) , \beta_i(G_z)=-\frac{1}{2^n}\binom{n}{n_{+}}+\frac{1}{2^n}=-\frac{1}{2^n}\left(\binom{n}{n_{+}}-1\right), β i ( G z ) = − 2 n 1 ( n + n ) + 2 n 1 = − 2 n 1 ( ( n + n ) − 1 ) ,
by Pascal’s rule (Lemma B.7), which yields the claim and concludes the proof.
Proof of Theorem 4.2. Similar to the proof of Theorem 4.1 we prove the claim by distinguishing between correct and incorrect classifiers.
Correct classifier. (C i ( x ) = y C_i(x)=y C i ( x ) = y ). Without loss of generality we fix y = y 1 y=y_1 y = y 1 . Hence, n + = p 1 ( C ) n_{+}=p_1(\mathcal{C}) n + = p 1 ( C ) . From Def. 3.2 and Lemma C.1 it follows that the coalitions i ∈ S i\in S i ∈ S , S ⊆ C S\subseteq\mathcal{C} S ⊆ C yielding a non-zero term for the difference v B ( S ) − v B ( S − i ) v_B(S)-v_B(S-i) v B ( S ) − v B ( S − i ) in the computation of the Shapley value ϕ i \phi_i ϕ i are such that, (1) S − i = ∅ S-i=\varnothing S − i = ∅ ; (2) p 1 ( S − i ) = p 2 ( S − i ) p_1(S-i)=p_2(S-i) p 1 ( S − i ) = p 2 ( S − i ) ; and (3) p 1 ( S − i ) = p 2 ( S − i ) − 1 p_1(S-i)=p_2(S-i)-1 p 1 ( S − i ) = p 2 ( S − i ) − 1 . Clearly in case (1) v B ( { i } ) − v B ( ∅ ) = 1 v_B(\{i\})-v_B(\varnothing)=1 v B ({ i }) − v B ( ∅ ) = 1 . Next, in cases (2) and (3) it holds that v B ( S ) − v B ( S − i ) = 1 2 v_B(S)-v_B(S-i)=\frac{1}{2} v B ( S ) − v B ( S − i ) = 2 1 , since C i ( x ) = y C_i(x)=y C i ( x ) = y . Recall that we let n + = ∣ { C ∈ C : C ( x ) = y } ∣ n_{+}=|\{C\in\mathcal{C}:C(x)=y\}| n + = ∣ { C ∈ C : C ( x ) = y } ∣ , and n − = n − n + n_{-}=n-n_{+} n − = n − n + . We can therefore express the Shapley values of Eq. (1) as
ϕ i = 1 n + 1 2 ( T 1 + T 2 ) , \phi_i=\frac{1}{n}+\frac{1}{2}(T_1+T_2), ϕ i = n 1 + 2 1 ( T 1 + T 2 ) ,
where
T 1 = ∑ h = 1 min { n + − 1 , n − } ( n − ( 2 h + 1 ) ) ! ( 2 h ) ! n ! ( n + − 1 h ) ( n − h ) T_1=\sum_{h=1}^{\min\{n_{+}-1,n_{-}\}}\frac{(n-(2h+1))!(2h)!}{n!}\binom{n_{+}-1}{h}\binom{n_{-}}{h} T 1 = h = 1 ∑ m i n { n + − 1 , n − } n ! ( n − ( 2 h + 1 ))! ( 2 h )! ( h n + − 1 ) ( h n − )
corresponds to the contribution for the Shapley value ϕ i \phi_i ϕ i provided by coalitions of the type S − i S-i S − i for which it holds p 1 ( S − i ) = p 2 ( S − i ) p_1(S-i)=p_2(S-i) p 1 ( S − i ) = p 2 ( S − i ) . Furthermore,
T 2 = ∑ h = 1 min { n + , n − } ( n − 2 h ) ! ( 2 h − 1 ) ! n ! ( n + − 1 h − 1 ) ( n − h ) T_2=\sum_{h=1}^{\min\{n_{+},n_{-}\}}\frac{(n-2h)!(2h-1)!}{n!}\binom{n_{+}-1}{h-1}\binom{n_{-}}{h} T 2 = h = 1 ∑ m i n { n + , n − } n ! ( n − 2 h )! ( 2 h − 1 )! ( h − 1 n + − 1 ) ( h n − )
corresponds to the contribution for the Shapley value ϕ i \phi_i ϕ i provided by coalitions S − i S-i S − i such that p 1 ( S − i ) = p 2 ( S − i ) − 1 p_1(S-i)=p_2(S-i)-1 p 1 ( S − i ) = p 2 ( S − i ) − 1 . Finally, the term 1 / n 1/n 1/ n accounts for S − i = ∅ S-i=\varnothing S − i = ∅ . Hence,
T 1 + T 2 = ( n − 2 n + ) ! ( 2 n + − 1 ) ! n ! ( n − n + ) + ∑ h = 1 min { n + − 1 , n − } ( n − h ) ( n − 2 h − 1 ) ! ( 2 h − 1 ) ! n ! [ ( n − 2 h ) ( n + − 1 h − 1 ) + 2 h ( n + − 1 h ) ] \begin{aligned}
T_1+T_2=\frac{(n-2n_{+})!(2n_{+}-1)!}{n!}\binom{n_{-}}{n_{+}} \\
&+ \sum_{h=1}^{\min\{n_{+}-1,n_{-}\}} \binom{n_{-}}{h} \frac{(n-2h-1)!(2h-1)!}{n!}\left[(n-2h)\binom{n_{+}-1}{h-1}+2h\binom{n_{+}-1}{h}\right]
\end{aligned} T 1 + T 2 = n ! ( n − 2 n + )! ( 2 n + − 1 )! ( n + n − ) + h = 1 ∑ m i n { n + − 1 , n − } ( h n − ) n ! ( n − 2 h − 1 )! ( 2 h − 1 )! [ ( n − 2 h ) ( h − 1 n + − 1 ) + 2 h ( h n + − 1 ) ]
By simple manipulations we obtain the first part of the claim
( n − 2 h ) ( n + − 1 h − 1 ) + 2 h ( n + − 1 h ) = ( a ) ( n − 2 h ) ( n + − 1 h − 1 ) + 2 ( n + − h ) ( n + − 1 h − 1 ) = ( n + − 1 h − 1 ) ( n + 2 n + − 4 h ) , \begin{aligned}
(n-2h)\binom{n_{+}-1}{h-1}+2h\binom{n_{+}-1}{h} \overset{(a)}{=} (n-2h)\binom{n_{+}-1}{h-1}+2(n_{+}-h)\binom{n_{+}-1}{h-1} \\
&= \binom{n_{+}-1}{h-1}(n+2n_{+}-4h),
\end{aligned} ( n − 2 h ) ( h − 1 n + − 1 ) + 2 h ( h n + − 1 ) = ( a ) ( n − 2 h ) ( h − 1 n + − 1 ) + 2 ( n + − h ) ( h − 1 n + − 1 ) = ( h − 1 n + − 1 ) ( n + 2 n + − 4 h ) ,
where in ( a ) (a) ( a ) we used the known identity k ( n k ) = n ( n k − 1 ) k\binom{n}{k}=n\binom{n}{k-1} k ( k n ) = n ( k − 1 n ) .
Incorrect classifier. (C i ( x ) ≠ y C_i(x) \ne y C i ( x ) = y ). Following the analysis of the case above, by noticing the analogy in the argument for incorrect classifiers, with respect to correct classifiers, we can express
ϕ i = − 1 2 ( ∑ h = 1 min { n − − 1 , n + } ( n − ( 2 h + 1 ) ) ! ( 2 h ) ! n ! ( n − − 1 h ) ( n + h ) + ∑ h = 1 min { n − , n + } ( n − 2 h ) ! ( 2 h − 1 ) ! n ! ( n − − 1 h − 1 ) ( n + h ) ) . \phi_i=-\frac{1}{2}\left(\sum_{h=1}^{\min\{n_{-}-1,n_{+}\}}\frac{(n-(2h+1))!(2h)!}{n!}\binom{n_{-}-1}{h}\binom{n_{+}}{h}+\sum_{h=1}^{\min\{n_{-},n_{+}\}}\frac{(n-2h)!(2h-1)!}{n!}\binom{n_{-}-1}{h-1}\binom{n_{+}}{h}\right). ϕ i = − 2 1 h = 1 ∑ m i n { n − − 1 , n + } n ! ( n − ( 2 h + 1 ))! ( 2 h )! ( h n − − 1 ) ( h n + ) + h = 1 ∑ m i n { n − , n + } n ! ( n − 2 h )! ( 2 h − 1 )! ( h − 1 n − − 1 ) ( h n + ) .
Following the same manipulations for the case of correct classifiers we obtain the claim. □
Proof of Theorem 4.3 . First we note that by the symmetry property, it is a trivial fact that ϕ i = ϕ i ′ \phi_i=\phi_{i'} ϕ i = ϕ i ′ and β i = β i ′ \beta_i=\beta_{i'} β i = β i ′ for any two classifiers i ≠ i ′ i\ne i' i = i ′ and i , i ′ ∈ [ n ] i,i'\in[n] i , i ′ ∈ [ n ] such that C i = C i ′ C_i=C_{i'} C i = C i ′ . Furthermore, recall that symmetry holds for both ϕ \phi ϕ and β \beta β . This property allows us to compute the closed-form solution of ϕ i \phi_i ϕ i and β i \beta_i β i only once for each game G z G_z G z , and assign such values to all classifier according to their predictions, as detailed below.
Banzhaf power index. The values of β i \beta_i β i , i ∈ [ n ] i\in[n] i ∈ [ n ] for all classifiers can be computed by evaluating the closed-form solution of Theorem 4.1 , in O ( 1 ) O(1) O ( 1 ) time. Furthermore, note that the value of β i ( G z ) \beta_i(G_z) β i ( G z ) , i ∈ [ n ] i\in[n] i ∈ [ n ] will be equal for all correct classifiers, and incorrect classifiers respectively over a fixed ( x , y ) ∈ D (x,y)\in\mathcal{D} ( x , y ) ∈ D by symmetry. Hence, we can compute the two terms of Theorem 4.1 , a single time for each test data point. Therefore, the complexity of obtaining β i ( G ( x , y ) ) \beta_i(G_{(x,y)}) β i ( G ( x , y ) ) is bounded by ∑ i = 1 n O ( 1 ) = O ( n ) \sum_{i=1}^{n}O(1)=O(n) ∑ i = 1 n O ( 1 ) = O ( n ) . To obtain β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) we use the linearity property of the Banzhaf power index, performing O ( ∣ D ∣ ) O(|\mathcal{D}|) O ( ∣ D ∣ ) computations, one on each test data point in D \mathcal{D} D . Yielding as final time complexity
∑ ( x , y ) ∈ D ∑ i = 1 n O ( 1 ) = O ( ∣ D ∣ n ) , \sum_{(x,y)\in\mathcal{D}}\sum_{i=1}^{n}O(1)=O(|\mathcal{D}|n), ( x , y ) ∈ D ∑ i = 1 ∑ n O ( 1 ) = O ( ∣ D ∣ n ) ,
which yields the first part of the claim.
Shapley power index. By Theorem 4.2 the values of ϕ i \phi_i ϕ i , i ∈ [ n ] i\in[n] i ∈ [ n ] for all classifiers can be computed through the evaluation of the summation from Eq. (5) . The summation can be evaluated once per each game G z G_z G z efficiently in linear time O ( n ) O(n) O ( n ) (see Sec. E). Similar to the Banzhaf case above, using the symmetry of Shapley values for a game G z G_z G z then all correct classifiers will have the same Shapley value. Similarly, all incorrect classifiers will also attain the same Shapley value, hence we only need to compute the summation in Eq. (5) at one time. That is we have to obtain ϕ i \phi_i ϕ i for a classifier i ∈ [ n ] i\in[n] i ∈ [ n ] such that C i ( x ) = y C_i(x)=y C i ( x ) = y . Then we know, thanks to the efficiency property, that
v B ( [ n ] ) = ∑ i ∈ [ n ] ϕ i = ∑ i : C i ( x ) = y ϕ i + ∑ i : C i ( x ) ≠ y ϕ i . v_{\mathrm{B}}([n])=\sum_{i\in[n]}\phi_i=\sum_{i:C_i(x)=y}\phi_i+\sum_{i:C_i(x)\ne y}\phi_i. v B ([ n ]) = i ∈ [ n ] ∑ ϕ i = i : C i ( x ) = y ∑ ϕ i + i : C i ( x ) = y ∑ ϕ i .
It follows that the value ϕ i \phi_i ϕ i , for any i i i such that C i ( x ) ≠ y C_i(x)\ne y C i ( x ) = y , can be computed by ( v B ( [ n ] ) − ∑ i : C i ( x ) = y ϕ i ) / n − (v_{\mathrm{B}}([n])-\sum_{i:C_i(x)=y}\phi_i)/n_{-} ( v B ([ n ]) − ∑ i : C i ( x ) = y ϕ i ) / n − , where n − = ∣ { i : C i ( x ) ≠ y } ∣ n_{-}=|\{i:C_i(x)\ne y\}| n − = ∣ { i : C i ( x ) = y } ∣ provided that n − > 0 n_{-}>0 n − > 0 . Therefore, the final complexity of the algorithm is bounded by
∑ ( x , y ) ∈ D ( O ( n ) + ∑ i = 1 n O ( 1 ) ) = O ( ∣ D ∣ n ) . \sum_{(x,y)\in\mathcal{D}}\left(O(n)+\sum_{i=1}^{n}O(1)\right)=O(|\mathcal{D}|n). ( x , y ) ∈ D ∑ ( O ( n ) + i = 1 ∑ n O ( 1 ) ) = O ( ∣ D ∣ n ) .
Concerning the memory complexity, note that by symmetry, we have to compute the values of β i \beta_i β i (or ϕ i \phi_i ϕ i ) only once per vote profile p ∈ U \boldsymbol{p} \in U p ∈ U . Storing the values of the power indices (for all vote profiles) requires O ( ∣ U ∣ ) O(|U|) O ( ∣ U ∣ ) memory and retaining the final output uses O ( n ) O(n) O ( n ) memory. Since ∣ U ∣ ≤ n + 1 |U| \le n + 1 ∣ U ∣ ≤ n + 1 in the binary classification setting, the total memory is O ( ∣ U ∣ + n ) = O ( n ) O(|U| + n) = O(n) O ( ∣ U ∣ + n ) = O ( n ) , concluding the proof.
Proofs of Sec. 4.2.1
Proof of Lemma 4.4 . Consider the expansion of the k k k -th order coefficient in P h ( t ) P_h(t) P h ( t ) for k ∈ [ 1 , ℓ − 1 ] k \in[1,\ell- 1] k ∈ [ 1 , ℓ − 1 ]
[ t k ] P h ( t ) = [ t k ] ∏ j = 2 ℓ ( A j ( h ) + B j ( h ) t ) = ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I B j ( h ) ∏ j ∉ I A j ( h ) ) = ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I ( n j h ) ∏ j ∉ I ∑ q = 0 h − 1 ( n j q ) ) . \begin{aligned}
[t^k]P_h(t) = [t^k]\prod_{j=2}^{\ell}(A_j(h) + B_j(h)t) \\
&= \sum_{\substack{I \subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}B_j(h)\prod_{j\notin I}A_j(h)\right) \\
&= \sum_{\substack{I \subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}\binom{n_j}{h}\prod_{j\notin I}\sum_{q=0}^{h-1}\binom{n_j}{q}\right).
\end{aligned} [ t k ] P h ( t ) = [ t k ] j = 2 ∏ ℓ ( A j ( h ) + B j ( h ) t ) = I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ B j ( h ) j ∈ / I ∏ A j ( h ) = I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ ( h n j ) j ∈ / I ∏ q = 0 ∑ h − 1 ( q n j ) .
The first equality follows from the definition of P h ( t ) P_h(t) P h ( t ) , the second from the expansion of a product of binomial terms, and the third by the definitions of A j ( h ) A_j(h) A j ( h ) and B j ( h ) B_j(h) B j ( h ) .
We now show that ∣ S ( k , h ) ∣ |S(k,h)| ∣ S ( k , h ) ∣ equals the above term via a combinatorial argument. By definition, S ( k , h ) S(k,h) S ( k , h ) contains subsets of classifiers S ⊆ C ′ S \subseteq C' S ⊆ C ′ that exclude the correct label y 1 y_1 y 1 . For any S ∈ S ( k , h ) S \in S(k,h) S ∈ S ( k , h ) , exactly k k k labels must have h h h votes, while all other labels j ∈ { 2 , … , ℓ } j \in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } must have strictly fewer than h h h votes.
We can construct such coalitions by first selecting a subset of labels I ⊆ { 2 , … , ℓ } I \subseteq\{2,\ldots,\ell\} I ⊆ { 2 , … , ℓ } of size ∣ I ∣ = k |I| = k ∣ I ∣ = k to attain h h h votes. For a fixed I I I , we calculate the number of choices T I T_I T I ,
forcing p j ( S ) = h p_j(S) = h p j ( S ) = h for j ∈ I j \in I j ∈ I : we must select exactly h h h classifiers for each label in I I I . There are ∏ j ∈ I ( n j h ) \prod_{j\in I}\binom{n_j}{h} ∏ j ∈ I ( h n j ) ways to do this;
forcing p j ( S ) < h p_j(S) < h p j ( S ) < h for j ∉ I j \notin I j ∈ / I : for each label j ∈ { 2 , … , ℓ } ∖ I j \in\{2,\ldots,\ell\}\setminus I j ∈ { 2 , … , ℓ } ∖ I , we must select q ∈ { 0 , … , h − 1 } q \in\{0,\ldots,h-1\} q ∈ { 0 , … , h − 1 } classifiers. Summing over possible values of q q q for a single label j j j gives ∑ q = 0 h − 1 ( n j q ) = A j ( h ) \sum_{q=0}^{h-1}\binom{n_j}{q}=A_j(h) ∑ q = 0 h − 1 ( q n j ) = A j ( h ) . Applying the product rule across all labels not in I I I gives ∏ j ∉ I A j ( h ) \prod_{j\notin I}A_j(h) ∏ j ∈ / I A j ( h ) .
Thus, T I = ∏ j ∈ I ( n j h ) ∏ j ∉ I A j ( h ) T_I = \prod_{j\in I}\binom{n_j}{h}\prod_{j\notin I}A_j(h) T I = ∏ j ∈ I ( h n j ) ∏ j ∈ / I A j ( h ) . Summing T I T_I T I over all possible subsets I I I of size k k k yields,
∣ S ( k , h ) ∣ = ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I ( n j h ) ∏ j ∉ I ∑ q = 0 h − 1 ( n j q ) ) = [ t k ] P h ( t ) , |S(k,h)| = \sum_{\substack{I\subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}\binom{n_j}{h}\prod_{j\notin I}\sum_{q=0}^{h-1}\binom{n_j}{q}\right) = [t^k]P_h(t), ∣ S ( k , h ) ∣ = I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ ( h n j ) j ∈ / I ∏ q = 0 ∑ h − 1 ( q n j ) = [ t k ] P h ( t ) ,
which concludes the proof.
Proof of Corollary 4.5 . By the definition of P h ( t ) P_h(t) P h ( t ) , factoring out the term for label y j y_j y j yields
P h ( t ) A j ( h ) + B j ( h ) t = ∏ j ′ = 2 j ′ ≠ j ℓ ( A j ′ ( h ) + B j ′ ( h ) t ) . \frac{P_h(t)}{A_j(h)+B_j(h)t} = \prod_{\substack{j'=2\\j'\ne j}}^{\ell}(A_{j'}(h)+B_{j'}(h)t). A j ( h ) + B j ( h ) t P h ( t ) = j ′ = 2 j ′ = j ∏ ℓ ( A j ′ ( h ) + B j ′ ( h ) t ) .
This expression is exactly the generating function from Lemma 4.4 applied to the ensemble C ′ ∖ { C ∈ C : C ( x ) = y j } C' \setminus\{C \in C : C(x)=y_j\} C ′ ∖ { C ∈ C : C ( x ) = y j } and the label set Y ∖ { y 1 , y j } Y \setminus\{y_1,y_j\} Y ∖ { y 1 , y j } . Since coalitions S ∈ S − j ( k , h ) S \in S_{-j}(k,h) S ∈ S − j ( k , h ) contain no classifiers with predictions for y j y_j y j , it follows that p j ( S ) = 0 p_j(S)=0 p j ( S ) = 0 . Applying an identical combinatorial counting argument as in Lemma 4.4 to the new product above yields the claim.
Proof of Theorem 4.6 . Let us first prove the claim for a correct classifier.
Correct classifier (C i ( x ) = y C_i(x)=y C i ( x ) = y ). Let S 1 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ > 1 , p 1 ( S − i ) = p j ( S − i ) , j ∈ M ( S − i ) } S_1=\{S\subseteq[n]:i\in S,S-i\ne\varnothing,|\mathcal{M}(S-i)|>1,p_1(S-i)=p_j(S-i),j\in\mathcal{M}(S-i)\} S 1 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ > 1 , p 1 ( S − i ) = p j ( S − i ) , j ∈ M ( S − i )} , and let S 2 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ > 0 , p 1 ( S − i ) = p j ( S − i ) − 1 , j ∈ M ( S − i ) } S_2=\{S\subseteq[n]:i\in S,S-i\ne\varnothing,|\mathcal{M}(S-i)|>0,p_1(S-i)=p_j(S-i)-1,j\in\mathcal{M}(S-i)\} S 2 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ > 0 , p 1 ( S − i ) = p j ( S − i ) − 1 , j ∈ M ( S − i )} . Furthermore let S 1 ( k ) = { S ∈ S 1 : ∣ M ( S − i ) ∣ = k } S_1(k)=\{S\in S_1:|\mathcal{M}(S-i)|=k\} S 1 ( k ) = { S ∈ S 1 : ∣ M ( S − i ) ∣ = k } for k ∈ [ 2 , ℓ ] k\in[2,\ell] k ∈ [ 2 , ℓ ] and S 2 ( k ) = { S ∈ S 2 : ∣ M ( S − i ) ∣ = k } S_2(k)=\{S\in S_2:|\mathcal{M}(S-i)|=k\} S 2 ( k ) = { S ∈ S 2 : ∣ M ( S − i ) ∣ = k } for k ∈ [ 1 , ℓ − 1 ] k\in[1,\ell-1] k ∈ [ 1 , ℓ − 1 ] . By Lemma C.2 we have that
2 n − 1 β i = ∑ i ∈ S ⊆ [ n ] v M C ( S ) − v M C ( S − i ) (7) 2^{n-1}\beta_i=\sum_{i\in S\subseteq[n]}v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) \tag*{(7)} 2 n − 1 β i = i ∈ S ⊆ [ n ] ∑ v MC ( S ) − v MC ( S − i ) (7)
= 1 + ∑ S ∈ S 1 ∣ M ( S − i ) ∣ − 1 ∣ M ( S − i ) ∣ + ∑ S ∈ S 2 1 ∣ M ( S − i ) ∣ + 1 (8) =1+\sum_{S\in S_1}\frac{|\mathcal{M}(S-i)|-1}{|\mathcal{M}(S-i)|}+\sum_{S\in S_2}\frac{1}{|\mathcal{M}(S-i)|+1} \tag*{(8)} = 1 + S ∈ S 1 ∑ ∣ M ( S − i ) ∣ ∣ M ( S − i ) ∣ − 1 + S ∈ S 2 ∑ ∣ M ( S − i ) ∣ + 1 1 (8)
= 1 + ∑ k = 2 ℓ ∑ S ∈ S 1 ( k ) k − 1 k + ∑ k = 1 ℓ − 1 ∑ S ∈ S 2 ( k ) 1 k + 1 (9) =1+\sum_{k=2}^{\ell}\sum_{S\in S_1(k)}\frac{k-1}{k}+\sum_{k=1}^{\ell-1}\sum_{S\in S_2(k)}\frac{1}{k+1} \tag*{(9)} = 1 + k = 2 ∑ ℓ S ∈ S 1 ( k ) ∑ k k − 1 + k = 1 ∑ ℓ − 1 S ∈ S 2 ( k ) ∑ k + 1 1 (9)
= 1 + ∑ k = 2 ℓ ∑ h = 1 n 1 − 1 k − 1 k ( n 1 − 1 h ) ∣ S ( k − 1 , h ) ∣ + ∑ k = 1 ℓ − 1 ∑ h = 0 n 1 − 1 1 k + 1 ( n 1 − 1 h ) ∣ S ( k , h + 1 ) ∣ (10) =1+\sum_{k=2}^{\ell}\sum_{h=1}^{n_1-1}\frac{k-1}{k}\binom{n_1-1}{h}|S(k-1,h)|+\sum_{k=1}^{\ell-1}\sum_{h=0}^{n_1-1}\frac{1}{k+1}\binom{n_1-1}{h}|S(k,h+1)| \tag*{(10)} = 1 + k = 2 ∑ ℓ h = 1 ∑ n 1 − 1 k k − 1 ( h n 1 − 1 ) ∣ S ( k − 1 , h ) ∣ + k = 1 ∑ ℓ − 1 h = 0 ∑ n 1 − 1 k + 1 1 ( h n 1 − 1 ) ∣ S ( k , h + 1 ) ∣ (10)
= 1 + ∑ h = 1 n 1 − 1 ( n 1 − 1 h ) ∑ k = 1 ℓ − 1 k k + 1 ∣ S ( k , h ) ∣ + ∑ h = 1 n 1 ( n 1 − 1 h − 1 ) ∑ k = 1 ℓ − 1 1 k + 1 ∣ S ( k , h ) ∣ (11) =1+\sum_{h=1}^{n_1-1}\binom{n_1-1}{h}\sum_{k=1}^{\ell-1}\frac{k}{k+1}|S(k,h)|+\sum_{h=1}^{n_1}\binom{n_1-1}{h-1}\sum_{k=1}^{\ell-1}\frac{1}{k+1}|S(k,h)| \tag*{(11)} = 1 + h = 1 ∑ n 1 − 1 ( h n 1 − 1 ) k = 1 ∑ ℓ − 1 k + 1 k ∣ S ( k , h ) ∣ + h = 1 ∑ n 1 ( h − 1 n 1 − 1 ) k = 1 ∑ ℓ − 1 k + 1 1 ∣ S ( k , h ) ∣ (11)
= 1 + ∑ h = 1 n 1 − 1 ∑ k = 1 ℓ − 1 ∣ S ( k , h ) ∣ k + 1 [ k ( n 1 − 1 h ) + ( n 1 − 1 h − 1 ) ] + ∑ k = 1 ℓ − 1 1 k + 1 ∣ S ( k , n 1 ) ∣ (12) =1+\sum_{h=1}^{n_1-1}\sum_{k=1}^{\ell-1}\frac{|S(k,h)|}{k+1}\left[k\binom{n_1-1}{h}+\binom{n_1-1}{h-1}\right]+\sum_{k=1}^{\ell-1}\frac{1}{k+1}|S(k,n_1)| \tag*{(12)} = 1 + h = 1 ∑ n 1 − 1 k = 1 ∑ ℓ − 1 k + 1 ∣ S ( k , h ) ∣ [ k ( h n 1 − 1 ) + ( h − 1 n 1 − 1 ) ] + k = 1 ∑ ℓ − 1 k + 1 1 ∣ S ( k , n 1 ) ∣ (12)
= 1 + ∑ h = 1 n 1 − 1 ∑ k = 1 ℓ − 1 [ x k ] P h ( x ) k + 1 [ k ( n 1 − 1 h ) + ( n 1 − 1 h − 1 ) ] + ∑ k = 1 ℓ − 1 [ x k ] P n 1 ( x ) k + 1 (13) =1+\sum_{h=1}^{n_1-1}\sum_{k=1}^{\ell-1}\frac{[x^k]P_h(x)}{k+1}\left[k\binom{n_1-1}{h}+\binom{n_1-1}{h-1}\right]+\sum_{k=1}^{\ell-1}\frac{[x^k]P_{n_1}(x)}{k+1} \tag*{(13)} = 1 + h = 1 ∑ n 1 − 1 k = 1 ∑ ℓ − 1 k + 1 [ x k ] P h ( x ) [ k ( h n 1 − 1 ) + ( h − 1 n 1 − 1 ) ] + k = 1 ∑ ℓ − 1 k + 1 [ x k ] P n 1 ( x ) (13)
= 1 + ∑ h = 1 n 1 ∑ k = 1 ℓ − 1 [ x k ] P h ( x ) k + 1 [ k ( n 1 − 1 h ) + ( n 1 − 1 h − 1 ) ] . (14) =1+\sum_{h=1}^{n_1}\sum_{k=1}^{\ell-1}\frac{[x^k]P_h(x)}{k+1}\left[k\binom{n_1-1}{h}+\binom{n_1-1}{h-1}\right]. \tag*{(14)} = 1 + h = 1 ∑ n 1 k = 1 ∑ ℓ − 1 k + 1 [ x k ] P h ( x ) [ k ( h n 1 − 1 ) + ( h − 1 n 1 − 1 ) ] . (14)
In the above derivation, Eq. (7) holds is by definition of Banzhaf value and Eq. (8) follows by Lemma C.2. Eq. (9) holds by the definition of S 1 ( k ) S_1(k) S 1 ( k ) and S 2 ( k ) S_2(k) S 2 ( k ) , noting that they form a partition of S 1 S_1 S 1 and S 2 S_2 S 2 , respectively. Eq. (10) follows from a combinatorial selection to count sets from S 1 ( k ) S_1(k) S 1 ( k ) and S 2 ( k ) S_2(k) S 2 ( k ) : we first choose the number of correct classifiers from { C : C ( x ) = y } \{C:C(x)=y\} { C : C ( x ) = y } and combine it with the definition of S ( k , h ) S(k,h) S ( k , h ) . Eqs. (11) , (12) and (13) follow from simple manipulations, including re-indexing and carrying out boundary terms. Finally, the claim in Eq. (14) follows from the fact that f ( k , n 1 ) = 1 f(k,n_1)=1 f ( k , n 1 ) = 1 since ( n 1 − 1 n 1 ) = 0 \binom{n_1-1}{n_1}=0 ( n 1 n 1 − 1 ) = 0 .
We now prove the remaining part of the claim for an incorrect classifier.
Incorrect classifier (C i ( x ) = y j C_i(x)=y_j C i ( x ) = y j , j ≠ 1 j\ne1 j = 1 ). We now let S 3 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ ≥ 2 , p 1 ( S − i ) = p j ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i ) } S_3=\{S\subseteq[n]:i\in S,S-i\ne\varnothing,|\mathcal{M}(S-i)|\ge2,p_1(S-i)=p_j(S-i)=p_{j'}(S-i),j'\in\mathcal{M}(S-i)\} S 3 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ ≥ 2 , p 1 ( S − i ) = p j ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i )} , and S 4 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ ≥ 1 , p j ( S − i ) + 1 = p 1 ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i ) } S_4=\{S\subseteq[n]:i\in S,S-i\ne\varnothing,|\mathcal{M}(S-i)|\ge1,p_j(S-i)+1=p_1(S-i)=p_{j'}(S-i),j'\in\mathcal{M}(S-i)\} S 4 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ ≥ 1 , p j ( S − i ) + 1 = p 1 ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i )} . In analogy with the previous case we partition the two sets above as S 3 ( k ) = { S ∈ S 3 : ∣ M ( S − i ) ∣ = k } S_3(k)=\{S\in S_3:|\mathcal{M}(S-i)|=k\} S 3 ( k ) = { S ∈ S 3 : ∣ M ( S − i ) ∣ = k } for k ∈ [ 2 , ℓ ] k\in[2,\ell] k ∈ [ 2 , ℓ ] and S 4 ( k ) = { S ∈ S 4 : ∣ M ( S − i ) ∣ = k } S_4(k)=\{S\in S_4:|\mathcal{M}(S-i)|=k\} S 4 ( k ) = { S ∈ S 4 : ∣ M ( S − i ) ∣ = k } for k ∈ [ 1 , ℓ − 1 ] k\in[1,\ell-1] k ∈ [ 1 , ℓ − 1 ] . We can compute the Banzhaf value as
− 2 n − 1 β i = − ∑ i ∈ S ⊆ [ n ] v M C ( S ) − v M C ( S − i ) (15) -2^{n-1}\beta_i=-\sum_{i\in S\subseteq[n]}v_{\mathrm{MC}}(S)-v_{\mathrm{MC}}(S-i) \tag*{(15)} − 2 n − 1 β i = − i ∈ S ⊆ [ n ] ∑ v MC ( S ) − v MC ( S − i ) (15)
= ∑ S ∈ S 3 1 ∣ M ( S − i ) ∣ + ∑ S ∈ S 4 1 ∣ M ( S − i ) ∣ ( ∣ M ( S − i ) ∣ + 1 ) (16) =\sum_{S\in S_3}\frac{1}{|\mathcal{M}(S-i)|}+\sum_{S\in S_4}\frac{1}{|\mathcal{M}(S-i)|(|\mathcal{M}(S-i)|+1)} \tag*{(16)} = S ∈ S 3 ∑ ∣ M ( S − i ) ∣ 1 + S ∈ S 4 ∑ ∣ M ( S − i ) ∣ ( ∣ M ( S − i ) ∣ + 1 ) 1 (16)
= ∑ k = 2 ℓ ∑ S ∈ S 3 ( k ) 1 k + ∑ k = 1 ℓ − 1 ∑ S ∈ S 4 ( k ) 1 k ( k + 1 ) = ∑ k = 2 ℓ ∑ h = 1 n j − 1 1 k ( n j − 1 h ) ( n 1 h ) ∣ S − j ( k − 2 , h ) ∣ (17) \begin{aligned}
=\sum_{k=2}^{\ell}\sum_{S\in S_3(k)}\frac{1}{k}+\sum_{k=1}^{\ell-1}\sum_{S\in S_4(k)}\frac{1}{k(k+1)} \\
&=\sum_{k=2}^{\ell}\sum_{h=1}^{n_j-1}\frac{1}{k}\binom{n_j-1}{h}\binom{n_1}{h}|S_{-j}(k-2,h)| \tag*{(17)}
\end{aligned} = k = 2 ∑ ℓ S ∈ S 3 ( k ) ∑ k 1 + k = 1 ∑ ℓ − 1 S ∈ S 4 ( k ) ∑ k ( k + 1 ) 1 = k = 2 ∑ ℓ h = 1 ∑ n j − 1 k 1 ( h n j − 1 ) ( h n 1 ) ∣ S − j ( k − 2 , h ) ∣ (17)
+ ∑ k = 1 ℓ − 1 ∑ h = 0 n j − 1 ( n j − 1 h ) ( n 1 h + 1 ) ∣ S − j ( k − 1 , h + 1 ) ∣ 1 k ( k + 1 ) (18) +\sum_{k=1}^{\ell-1}\sum_{h=0}^{n_j-1}\binom{n_j-1}{h}\binom{n_1}{h+1}\lvert S_{-j}(k-1,h+1)\rvert\frac{1}{k(k+1)} \tag*{(18)} + k = 1 ∑ ℓ − 1 h = 0 ∑ n j − 1 ( h n j − 1 ) ( h + 1 n 1 ) ∣ S − j ( k − 1 , h + 1 )∣ k ( k + 1 ) 1 (18)
= ∑ h = 1 n j ∑ k = 0 ℓ − 2 ( n j − 1 h ) ( n 1 h ) ∣ S − j ( k , h ) ∣ k + 2 + ∑ h = 1 n j ∑ k = 0 ℓ − 2 ( n j − 1 h − 1 ) ( n 1 h ) ∣ S − j ( k , h ) ∣ ( k + 1 ) ( k + 2 ) (19) =\sum_{h=1}^{n_j}\sum_{k=0}^{\ell-2}\binom{n_j-1}{h}\binom{n_1}{h}\frac{\lvert S_{-j}(k,h)\rvert}{k+2}+\sum_{h=1}^{n_j}\sum_{k=0}^{\ell-2}\binom{n_j-1}{h-1}\binom{n_1}{h}\frac{\lvert S_{-j}(k,h)\rvert}{(k+1)(k+2)} \tag*{(19)} = h = 1 ∑ n j k = 0 ∑ ℓ − 2 ( h n j − 1 ) ( h n 1 ) k + 2 ∣ S − j ( k , h )∣ + h = 1 ∑ n j k = 0 ∑ ℓ − 2 ( h − 1 n j − 1 ) ( h n 1 ) ( k + 1 ) ( k + 2 ) ∣ S − j ( k , h )∣ (19)
= ∑ h = 1 n j ∑ k = 0 ℓ − 2 ∣ S − j ( k , h ) ∣ k + 2 ( n 1 h ) [ ( n j − 1 h ) + 1 k + 1 ( n j − 1 h − 1 ) ] (20) =\sum_{h=1}^{n_j}\sum_{k=0}^{\ell-2}\frac{\lvert S_{-j}(k,h)\rvert}{k+2}\binom{n_1}{h}\left[\binom{n_j-1}{h}+\frac{1}{k+1}\binom{n_j-1}{h-1}\right] \tag*{(20)} = h = 1 ∑ n j k = 0 ∑ ℓ − 2 k + 2 ∣ S − j ( k , h )∣ ( h n 1 ) [ ( h n j − 1 ) + k + 1 1 ( h − 1 n j − 1 ) ] (20)
= ∑ h = 1 n j ∑ k = 0 ℓ − 2 f j ( k , h ) k + 2 [ t k ] P h ( t ) A j ( h ) + B j ( h ) t . (21) =\sum_{h=1}^{n_j}\sum_{k=0}^{\ell-2}\frac{f_j(k,h)}{k+2}[t^k]\frac{P_h(t)}{A_j(h)+B_j(h)t}. \tag*{(21)} = h = 1 ∑ n j k = 0 ∑ ℓ − 2 k + 2 f j ( k , h ) [ t k ] A j ( h ) + B j ( h ) t P h ( t ) . (21)
In the above derivations, Eq. (15) follows by Def. 3.2 . Eq. (16) follows by Lemma C.2 . Eq. (17) follows by noting that S 3 ( k ) S_3(k) S 3 ( k ) and S 4 ( k ) S_4(k) S 4 ( k ) form a partition of S 3 S_3 S 3 and S 4 S_4 S 4 respectively. Eq. (18) follows by counting the sets in S 3 ( k ) S_3(k) S 3 ( k ) and S 4 ( k ) S_4(k) S 4 ( k ) with a combinatorial argument. We now discuss how to build sets from S 3 ( k ) S_3(k) S 3 ( k ) . That is, (i) we first select the h ≥ 1 h \ge1 h ≥ 1 classifiers voting for y j y_j y j for which we have ( n j − 1 h ) \binom{n_j-1}{h} ( h n j − 1 ) possible choice; (ii) we then select the number of correct classifiers to match the h h h classifiers in S − i S-i S − i selected, for which we have ( n 1 h ) \binom{n_1}{h} ( h n 1 ) possible choices (iii) for any k ≥ 2 k \ge2 k ≥ 2 we have to fix k − 2 k-2 k − 2 labels to tie the h h h votes for y j y_j y j and y 1 y_1 y 1 , and all remaining labels (with possibly no votes) to have strictly less than h h h votes. This corresponds exactly to the definition of ∣ S − j ( k − 2 , h ) ∣ \lvert S_{-j}(k-2,h)\rvert ∣ S − j ( k − 2 , h )∣ . Summing over all possible values of h h h for fixed k k k yields the first part of Eq. (18) . The sets of S 4 ( k ) S_4(k) S 4 ( k ) follow an analogous construction yielding Eq. (18) . Finally, Eqs (19) and (20) follow by simple algebraic manipulations and summation re-indexing. Finally, Eq. (21) follows by the definition of f j ( k , h ) f_j(k,h) f j ( k , h ) . This concludes the proof. □
Proof of Theorem 4.7 . Consider two data points d 1 = ( x 1 , y 1 ) d_1=(x_1,y_1) d 1 = ( x 1 , y 1 ) and d 2 = ( x 2 , y 2 ) d_2=(x_2,y_2) d 2 = ( x 2 , y 2 ) with identical vote profiles. By the symmetry axiom, and as captured by our Theorem 4.6 , the values of β i ( G d 1 ) \beta_i(G_{d_1}) β i ( G d 1 ) and β i ( G d 2 ) \beta_i(G_{d_2}) β i ( G d 2 ) depend strictly on the values n j n_j n j for j ∈ [ ℓ ] j\in[\ell] j ∈ [ ℓ ] . That is, under two identical vote profiles d 1 = p d 2 d_1=p d_2 d 1 = p d 2 , it holds that β i ( G d 1 ) = β i ′ ( G d 2 ) \beta_i(G_{d_1})=\beta_{i'}(G_{d_2}) β i ( G d 1 ) = β i ′ ( G d 2 ) if either both i i i and i ′ i' i ′ vote for the correct label, or if C i ( x 1 ) = y j C_i(x_1)=y_j C i ( x 1 ) = y j and C i ′ ( x 2 ) = y j ′ C_{i'}(x_2)=y_{j'} C i ′ ( x 2 ) = y j ′ where j , j ′ ≠ 1 j,j'\ne1 j , j ′ = 1 and n j = n j ′ n_j=n_{j'} n j = n j ′ . This observation allows us to compute the Banzhaf values exactly once per unique vote profile, caching the result and reusing it in O ( 1 ) O(1) O ( 1 ) time for any two points with the same vote profile.
For a unique vote profile of ( x , y ) (x,y) ( x , y ) , the algorithm first obtains n j n_j n j , j ∈ [ ℓ ] j\in[\ell] j ∈ [ ℓ ] in O ( n ) O(n) O ( n ) time. Then, the algorithm iterates over h ∈ [ n 1 ] h\in[n_1] h ∈ [ n 1 ] . Inside this loop, it computes the coefficients of the polynomial P h ( t ) P_h(t) P h ( t ) in O ( ℓ 2 ) O(\ell^2) O ( ℓ 2 ) time. The contribution to β i \beta_i β i for any correct classifier provided by P h ( t ) P_h(t) P h ( t ) is computed in O ( ℓ ) O(\ell) O ( ℓ ) time. Next, for each incorrect class j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , the algorithm obtains the polynomial Q h j ( t ) = P h ( t ) / ( A j ( h ) + B j ( h ) t ) Q^j_h(t)=P_h(t)/(A_j(h)+B_j(h)t) Q h j ( t ) = P h ( t ) / ( A j ( h ) + B j ( h ) t ) in O ( ℓ ) O(\ell) O ( ℓ ) time. Evaluating the contribution to β i \beta_i β i for any classifier voting for y j y_j y j in O ( ℓ ) O(\ell) O ( ℓ ) time. By caching P h ( t ) P_h(t) P h ( t ) the algorithm can process all incorrect classes in ∑ j = 2 ℓ O ( ℓ ) \sum_{j=2}^{\ell}O(\ell) ∑ j = 2 ℓ O ( ℓ ) time. After processing each unique profile of U U U , we iterate through all classifiers correcting for the factor 2 n − 1 2^{n-1} 2 n − 1 as shown by Theorem 4.6 , which takes O ( n ) O(n) O ( n ) per vote profile. Finally, the output corrects for the factor ∣ D ∣ \lvert D\rvert ∣ D ∣ , using the linearity property of power indices.
The overall time complexity is bounded by
∑ u = 1 ∣ U ∣ ( O ( n ) + ∑ h = 1 n 1 [ O ( ℓ 2 ) + O ( ℓ ) + ∑ j = 2 ℓ O ( ℓ ) ] ) + O ( ∣ D ∣ n ) = O ( ∣ U ∣ n ℓ 2 + ∣ D ∣ n ) , \sum_{u=1}^{\lvert U\rvert}\left(O(n)+\sum_{h=1}^{n_1}\left[O(\ell^2)+O(\ell)+\sum_{j=2}^{\ell}O(\ell)\right]\right)+O(\lvert D\rvert n)=O(\lvert U\rvert n\ell^2+\lvert D\rvert n), u = 1 ∑ ∣ U ∣ ( O ( n ) + h = 1 ∑ n 1 [ O ( ℓ 2 ) + O ( ℓ ) + j = 2 ∑ ℓ O ( ℓ ) ] ) + O (∣ D ∣ n ) = O (∣ U ∣ n ℓ 2 + ∣ D ∣ n ) ,
where the O ( ∣ D ∣ n ) O(\lvert D\rvert n) O (∣ D ∣ n ) is required to evaluate the predictions of all classifiers of C C C . If predictions are provided in input, e.g., through a preprocessing, then such term can be dropped.
Finally, the algorithm requires no more than O ( ∣ U ∣ ℓ + n + ℓ n ) = O ( ℓ ( n + ∣ U ∣ ) ) O(\lvert U\rvert\ell+n+\ell n)=O(\ell(n+\lvert U\rvert)) O (∣ U ∣ ℓ + n + ℓ n ) = O ( ℓ ( n + ∣ U ∣)) auxiliary space. That is, 1. O ( ∣ U ∣ ℓ ) O(\lvert U\rvert\ell) O (∣ U ∣ ℓ ) is required to store the dictionaries of unique vote profiles and the Banzhaf values of their game; 2. O ( n ) O(n) O ( n ) is necessary to accumulate the global output for the ensemble; 3. finally O ( ℓ ) O(\ell) O ( ℓ ) is required to store the coefficients of the polynomial P h ( t ) P_h(t) P h ( t ) for any iteration h ≥ 1 h\ge1 h ≥ 1 , which concludes the proof. □
Proofs of Sec. 4.2.2
Lemma C.5. Let ( x , y ) ∈ D (x,y)\in\mathcal{D} ( x , y ) ∈ D be a test data point. Without loss of generality, let y = y 1 ∈ Y y=y_1\in\mathcal{Y} y = y 1 ∈ Y . For any h ≥ 1 h\ge1 h ≥ 1 and j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , we define the two polynomials
A j ( h ; u ) = ∑ q = 0 h − 1 ( n j q ) u q and B j ( h ; u ) = ( n j h ) u h . A_j(h;u)=\sum_{q=0}^{h-1}\binom{n_j}{q}u^q \quad\text{and}\quad B_j(h;u)=\binom{n_j}{h}u^h. A j ( h ; u ) = q = 0 ∑ h − 1 ( q n j ) u q and B j ( h ; u ) = ( h n j ) u h .
Consider the ordinary generating function P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + t B j ( h ; u ) ) P_h(t,u)=\prod_{j=2}^{\ell}(A_j(h;u)+tB_j(h;u)) P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + t B j ( h ; u )) .
Fix h ∈ [ n ] h\in[n] h ∈ [ n ] , k ∈ { 1 , … , ℓ − 1 } k\in\{1,\ldots,\ell-1\} k ∈ { 1 , … , ℓ − 1 } , and m ≥ 0 m\ge0 m ≥ 0 . Let S ( k , h , m ) S(k,h,m) S ( k , h , m ) be the set of coalitions S ⊆ C ′ S\subseteq C' S ⊆ C ′ such that: (i) C ′ = C ∖ { C ∈ C : C ( x ) = y } C'=C\setminus\{C\in C:C(x)=y\} C ′ = C ∖ { C ∈ C : C ( x ) = y } ; (ii) ∣ M ( S ) ∣ = k |\mathcal{M}(S)|=k ∣ M ( S ) ∣ = k ; (iii) p j ( S ) = h p_j(S)=h p j ( S ) = h for each j ∈ M ( S ) j\in\mathcal{M}(S) j ∈ M ( S ) ; and (iv) the number of classifiers in S S S is exactly ∣ S ∣ = m |S|=m ∣ S ∣ = m . Then it holds that
∣ S ( k , h , m ) ∣ = [ t k u m ] P h ( t , u ) . |S(k,h,m)|=[t^ku^m]P_h(t,u). ∣ S ( k , h , m ) ∣ = [ t k u m ] P h ( t , u ) .
Proof. We now expand P h ( t , u ) P_h(t,u) P h ( t , u ) . To do so we first extract the k k k -th coefficient in t t t . That is, analogously to the proof of Lemma 4.4 it holds that
[ t k u m ] P h ( t , u ) = [ u m ] ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I B j ( h ; u ) ∏ j ∉ I A j ( h ; u ) ) = [ u m ] ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I ( n j h ) u h ∏ j ∉ I ∑ q j = 0 h − 1 ( n j q j ) u q j ) = ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I ( n j h ) [ u m − k h ] ∏ j ∉ I ∑ q j = 0 h − 1 ( n j q j ) u q j ) = ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I ( n j h ) ∑ q j ∈ { 0 , … , h − 1 } for all j ∉ I ∑ j ∉ I q j = m − k h ∏ j ∉ I ( n j q j ) ) . \begin{aligned}
[t^ku^m]P_h(t,u)=[u^m]\sum_{\substack{I\subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}B_j(h;u)\prod_{j\notin I}A_j(h;u)\right) \\
&=[u^m]\sum_{\substack{I\subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}\binom{n_j}{h}u^h\prod_{j\notin I}\sum_{q_j=0}^{h-1}\binom{n_j}{q_j}u^{q_j}\right) \\
&=\sum_{\substack{I\subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}\binom{n_j}{h}[u^{m-kh}]\prod_{j\notin I}\sum_{q_j=0}^{h-1}\binom{n_j}{q_j}u^{q_j}\right) \\
&=\sum_{\substack{I\subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}\binom{n_j}{h}\sum_{\substack{q_j\in\{0,\ldots,h-1\}\text{ for all }j\notin I\\ \sum_{j\notin I}q_j=m-kh}}\prod_{j\notin I}\binom{n_j}{q_j}\right).
\end{aligned} [ t k u m ] P h ( t , u ) = [ u m ] I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ B j ( h ; u ) j ∈ / I ∏ A j ( h ; u ) = [ u m ] I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ ( h n j ) u h j ∈ / I ∏ q j = 0 ∑ h − 1 ( q j n j ) u q j = I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ ( h n j ) [ u m − k h ] j ∈ / I ∏ q j = 0 ∑ h − 1 ( q j n j ) u q j = I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ ( h n j ) q j ∈ { 0 , … , h − 1 } for all j ∈ / I ∑ j ∈ / I q j = m − k h ∑ j ∈ / I ∏ ( q j n j ) .
The first equality extracts the coefficient of [ t k ] [t^k] [ t k ] , and the second equality expands terms A A A and B B B by their definition. The third equality follows by noting that ∏ j ∈ I u h = u k h \prod_{j\in I}u^h=u^{kh} ∏ j ∈ I u h = u k h . Therefore, the extraction of [ u m ] [u^m] [ u m ] corresponds to extracting [ u m − k h ] [u^{m-kh}] [ u m − k h ] from the polynomial ∏ j ∉ I ∑ q j = 0 h − 1 ( n j q j ) u q j \prod_{j\notin I}\sum_{q_j=0}^{h-1}\binom{n_j}{q_j}u^{q_j} ∏ j ∈ / I ∑ q j = 0 h − 1 ( q j n j ) u q j . Finally, the last equality follows by the definition of polynomial multiplication (Cauchy product). We now show that ∣ S ( k , h , m ) ∣ |S(k,h,m)| ∣ S ( k , h , m ) ∣ corresponds to the above term by a combinatorial argument. By definition, S ( k , h , m ) S(k,h,m) S ( k , h , m ) contains subsets S ⊆ C ′ S\subseteq C' S ⊆ C ′ , where classifiers voting for the correct label are excluded from C ′ C' C ′ . For any S ∈ S ( k , h , m ) S\in S(k,h,m) S ∈ S ( k , h , m ) , exactly k k k labels must receive exactly h h h votes, all other incorrect labels must receive strictly fewer than h h h votes, and the total number of classifiers in S S S must sum to m m m .
We now construct a coalition from S ( k , h , m ) S(k,h,m) S ( k , h , m ) as follows. We first select a subset of labels I ⊆ { 2 , … , ℓ } I\subseteq\{2,\ldots,\ell\} I ⊆ { 2 , … , ℓ } of size ∣ I ∣ = k |I|=k ∣ I ∣ = k corresponding to the k k k labels receiving exactly h h h votes. For a fixed I I I , we compute the number of sets that belong to S ( k , h , m ) S(k,h,m) S ( k , h , m ) as follows
forcing p j ( S ) = h p_j(S)=h p j ( S ) = h for $j\in I : we select exactly h h h classifiers for each label in I I I . This yields ∏ j ∈ I ( n j h ) \prod_{j\in I}\binom{n_j}{h} ∏ j ∈ I ( h n j ) possible combinations. Note that, the selection of such classifiers collectively contributes to k h kh k h classifiers in the final set S ∈ S ( k , h , m ) S\in S(k,h,m) S ∈ S ( k , h , m ) .
forcing p j ( S ) < h p_j(S)<h p j ( S ) < h for $j\notin I : for each remaining incorrect label j ∈ { 2 , … , ℓ } ∖ I j\in\{2,\ldots,\ell\}\setminus I j ∈ { 2 , … , ℓ } ∖ I , we must select q j ∈ { 0 , … , h − 1 } q_j\in\{0,\ldots,h-1\} q j ∈ { 0 , … , h − 1 } classifiers. For a specific sequence of choices ( q j ) j ∉ I (q_j)_{j\notin I} ( q j ) j ∈ / I , there are ∏ j ∉ I ( n j q j ) \prod_{j\notin I}\binom{n_j}{q_j} ∏ j ∈ / I ( q j n j ) ways to select the classifiers. Note that, given the additional constraint of ∣ S ∣ = m |S|=m ∣ S ∣ = m , then it must hold that a valid selection yields ∑ j ∉ I q j = m − ∑ j ∈ I h = m − k h \sum_{j\notin I}q_j=m-\sum_{j\in I}h=m-kh ∑ j ∈ / I q j = m − ∑ j ∈ I h = m − k h .
Therefore, by summing over all possible subsets I I I we get
∣ S ( k , h , m ) ∣ = ∑ I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ( ∏ j ∈ I ( n j h ) ∑ q j ∈ { 0 , … , h − 1 } for all j ∉ I ∑ j ∉ I q j = m − k h ∏ j ∉ I ( n j q j ) ) = [ t k u m ] P h ( t , u ) , |S(k,h,m)|=\sum_{\substack{I\subseteq\{2,\ldots,\ell\}\\ |I|=k}}\left(\prod_{j\in I}\binom{n_j}{h}\sum_{\substack{q_j\in\{0,\ldots,h-1\}\text{ for all }j\notin I\\ \sum_{j\notin I}q_j=m-kh}}\prod_{j\notin I}\binom{n_j}{q_j}\right)=[t^ku^m]P_h(t,u), ∣ S ( k , h , m ) ∣ = I ⊆ { 2 , … , ℓ } ∣ I ∣ = k ∑ j ∈ I ∏ ( h n j ) q j ∈ { 0 , … , h − 1 } for all j ∈ / I ∑ j ∈ / I q j = m − k h ∑ j ∈ / I ∏ ( q j n j ) = [ t k u m ] P h ( t , u ) ,
concluding the proof. □
Corollary C.6. Under the setting of Lemma C.5, fix j ∈ { 2 , … , ℓ } j\in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } . Let S − j ( k , h , m ) S_{-j}(k,h,m) S − j ( k , h , m ) be defined analogously to S ( k , h , m ) S(k,h,m) S ( k , h , m ) for coalitions S ⊆ C ′ ∖ { C ∈ C : C ( x ) = y j } S\subseteq C'\setminus\{C\in C:C(x)=y_j\} S ⊆ C ′ ∖ { C ∈ C : C ( x ) = y j } . That is, a coalition S S S from S − j ( k , h , m ) S_{-j}(k,h,m) S − j ( k , h , m ) contains no classifier voting for class y j y_j y j . Then it holds that
∣ S − j ( k , h , m ) ∣ = [ t k u m ] P h ( t , u ) A j ( h ; u ) + B j ( h ; u ) t . |S_{-j}(k,h,m)|=[t^ku^m]\frac{P_h(t,u)}{A_j(h;u)+B_j(h;u)t}. ∣ S − j ( k , h , m ) ∣ = [ t k u m ] A j ( h ; u ) + B j ( h ; u ) t P h ( t , u ) .
Proof. The proof follows an analogous argument to that of Corollary 4.5 . By the definition of P h ( t , u ) P_h(t,u) P h ( t , u ) , factoring out the term for label y j y_j y j , j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] yields
P h ( t , u ) A j ( h ; u ) + B j ( h ; u ) t = ∏ j ′ = 2 j ′ ≠ j ℓ ( A j ′ ( h ; u ) + B j ′ ( h ; u ) t ) . \frac{P_h(t,u)}{A_j(h;u)+B_j(h;u)t}=\prod_{\substack{j'=2\\j'\ne j}}^\ell(A_{j'}(h;u)+B_{j'}(h;u)t). A j ( h ; u ) + B j ( h ; u ) t P h ( t , u ) = j ′ = 2 j ′ = j ∏ ℓ ( A j ′ ( h ; u ) + B j ′ ( h ; u ) t ) .
This expression is exactly the generating function from Lemma C.5 applied to the ensemble C ′ ∖ { C ∈ C : C ( x ) = y j } C'\setminus\{C\in C:C(x)=y_j\} C ′ ∖ { C ∈ C : C ( x ) = y j } and the label set Y ∖ { y 1 , y j } Y\setminus\{y_1,y_j\} Y ∖ { y 1 , y j } . Since coalitions S ∈ S − j ( k , h , m ) S\in S_{-j}(k,h,m) S ∈ S − j ( k , h , m ) contain no classifiers with predictions for y j y_j y j , it follows that p j ( S ) = 0 p_j(S)=0 p j ( S ) = 0 . Applying an identical combinatorial counting argument as in Lemma C.5 to the new product above yields the claim. □
Proof of Theorem 4.8 . Let us first prove the claim for a correct classifier.
Correct classifier (C i ( x ) = y C_i(x)=y C i ( x ) = y ). Similarly to the proof of Theorem 4.6 . Let S 1 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ > 1 , p 1 ( S − i ) = p j ( S − i ) , j ∈ M ( S − i ) } S_1=\{S\subseteq[n]:i\in S,S-i\ne\varnothing,|\mathcal{M}(S-i)|>1,p_1(S-i)=p_j(S-i),j\in\mathcal{M}(S-i)\} S 1 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ > 1 , p 1 ( S − i ) = p j ( S − i ) , j ∈ M ( S − i )} , and let S 2 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ > 0 , p 1 ( S − i ) = p j ( S − i ) − 1 , j ∈ M ( S − i ) } S_2=\{S\subseteq[n]:i\in S,S-i\ne\varnothing,|\mathcal{M}(S-i)|>0,p_1(S-i)=p_j(S-i)-1,j\in\mathcal{M}(S-i)\} S 2 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ > 0 , p 1 ( S − i ) = p j ( S − i ) − 1 , j ∈ M ( S − i )} . We have that,
ϕ i = ∑ i ∈ S ⊆ C η ( ∣ S ∣ ) ( v ( S ) − v ( S − i ) ) (22) \phi_i=\sum_{i\in S\subseteq C}\eta(|S|)(v(S)-v(S-i)) \tag*{(22)} ϕ i = i ∈ S ⊆ C ∑ η ( ∣ S ∣ ) ( v ( S ) − v ( S − i )) (22)
= 1 n + ∑ S ∈ S 1 η ( ∣ S ∣ ) ∣ M ( S − i ) ∣ − 1 ∣ M ( S − i ) ∣ + ∑ S ∈ S 2 η ( ∣ S ∣ ) 1 ∣ M ( S − i ) ∣ + 1 (23) =\frac{1}{n}+\sum_{S\in S_1}\eta(|S|)\frac{|\mathcal{M}(S-i)|-1}{|\mathcal{M}(S-i)|}+\sum_{S\in S_2}\eta(|S|)\frac{1}{|\mathcal{M}(S-i)|+1} \tag*{(23)} = n 1 + S ∈ S 1 ∑ η ( ∣ S ∣ ) ∣ M ( S − i ) ∣ ∣ M ( S − i ) ∣ − 1 + S ∈ S 2 ∑ η ( ∣ S ∣ ) ∣ M ( S − i ) ∣ + 1 1 (23)
= 1 n + ∑ k = 2 ℓ ∑ h = 1 n 1 − 1 ∑ m = ( k − 1 ) h n − n 1 k − 1 k η ( m + h + 1 ) ( n 1 − 1 h ) ∣ S ( k − 1 , h , m ) ∣ + ∑ k = 1 ℓ − 1 ∑ h = 0 n 1 − 1 ∑ m = k ( h + 1 ) n − n 1 1 k + 1 η ( m + h + 1 ) ( n 1 − 1 h ) ∣ S ( k , h + 1 , m ) ∣ (24) =\frac{1}{n}+\sum_{k=2}^{\ell}\sum_{h=1}^{n_1-1}\sum_{m=(k-1)h}^{n-n_1}\frac{k-1}{k}\eta(m+h+1)\binom{n_1-1}{h}|S(k-1,h,m)|
+\sum_{k=1}^{\ell-1}\sum_{h=0}^{n_1-1}\sum_{m=k(h+1)}^{n-n_1}\frac{1}{k+1}\eta(m+h+1)\binom{n_1-1}{h}|S(k,h+1,m)| \tag*{(24)} = n 1 + k = 2 ∑ ℓ h = 1 ∑ n 1 − 1 m = ( k − 1 ) h ∑ n − n 1 k k − 1 η ( m + h + 1 ) ( h n 1 − 1 ) ∣ S ( k − 1 , h , m ) ∣ + k = 1 ∑ ℓ − 1 h = 0 ∑ n 1 − 1 m = k ( h + 1 ) ∑ n − n 1 k + 1 1 η ( m + h + 1 ) ( h n 1 − 1 ) ∣ S ( k , h + 1 , m ) ∣ (24)
= 1 n + ∑ k = 1 ℓ − 1 ∑ h = 1 n 1 − 1 ∑ m = k h n − n 1 k k + 1 η ( m + h + 1 ) ( n 1 − 1 h ) ∣ S ( k , h , m ) ∣ + ∑ k = 1 ℓ − 1 ∑ h = 1 n 1 ∑ m = k h n − n 1 1 k + 1 η ( m + h ) ( n 1 − 1 h − 1 ) ∣ S ( k , h , m ) ∣ (25) =\frac{1}{n}+\sum_{k=1}^{\ell-1}\sum_{h=1}^{n_1-1}\sum_{m=kh}^{n-n_1}\frac{k}{k+1}\eta(m+h+1)\binom{n_1-1}{h}|S(k,h,m)|
+\sum_{k=1}^{\ell-1}\sum_{h=1}^{n_1}\sum_{m=kh}^{n-n_1}\frac{1}{k+1}\eta(m+h)\binom{n_1-1}{h-1}|S(k,h,m)| \tag*{(25)} = n 1 + k = 1 ∑ ℓ − 1 h = 1 ∑ n 1 − 1 m = k h ∑ n − n 1 k + 1 k η ( m + h + 1 ) ( h n 1 − 1 ) ∣ S ( k , h , m ) ∣ + k = 1 ∑ ℓ − 1 h = 1 ∑ n 1 m = k h ∑ n − n 1 k + 1 1 η ( m + h ) ( h − 1 n 1 − 1 ) ∣ S ( k , h , m ) ∣ (25)
= 1 n + ∑ k = 1 ℓ − 1 ∑ h = 1 n 1 ∑ m = k h n − n 1 1 k + 1 ( k η ( m + h + 1 ) ( n 1 − 1 h ) + η ( m + h ) ( n 1 − 1 h − 1 ) ) ∣ S ( k , h , m ) ∣ (26) =\frac{1}{n}+\sum_{k=1}^{\ell-1}\sum_{h=1}^{n_1}\sum_{m=kh}^{n-n_1}\frac{1}{k+1}\left(k\eta(m+h+1)\binom{n_1-1}{h}+\eta(m+h)\binom{n_1-1}{h-1}\right)|S(k,h,m)| \tag*{(26)} = n 1 + k = 1 ∑ ℓ − 1 h = 1 ∑ n 1 m = k h ∑ n − n 1 k + 1 1 ( k η ( m + h + 1 ) ( h n 1 − 1 ) + η ( m + h ) ( h − 1 n 1 − 1 ) ) ∣ S ( k , h , m ) ∣ (26)
= 1 n + ∑ k = 1 ℓ − 1 ∑ h = 1 n 1 ∑ m = k h n − n 1 f 1 ( k , h , m ) [ t k u m ] P h ( t , u ) , (27) =\frac{1}{n}+\sum_{k=1}^{\ell-1}\sum_{h=1}^{n_1}\sum_{m=kh}^{n-n_1}f_1(k,h,m)[t^ku^m]P_h(t,u), \tag*{(27)} = n 1 + k = 1 ∑ ℓ − 1 h = 1 ∑ n 1 m = k h ∑ n − n 1 f 1 ( k , h , m ) [ t k u m ] P h ( t , u ) , (27)
where Eq. (22) follows by the definition of Shapley (Eq. (1) ), Eq. (23) follow by Lemma C.2 , and the definition of S 1 S_1 S 1 and S 2 S_2 S 2 . Eq. (24) follows by summing over all sets of S 1 S_1 S 1 and S 2 S_2 S 2 . We show how to account for the summation over the sets in S 1 S_1 S 1 , the summation accounting for sets in S 2 S_2 S 2 follows an analogous formulation. That is, (i) first we fix the number of classes in M ( S − i ) \mathcal{M}(S-i) M ( S − i ) that vote for an incorrect label (i.e., k k k ); (ii) for each incorrect label we fix the cardinality of the classifiers voting for it (i.e., h h h ) (iii) we then weight the number of sets S ∈ S 1 S \in S_1 S ∈ S 1 with i ∈ S i \in S i ∈ S with the product rule, by first selecting ( n 1 − 1 h ) \binom{n_1-1}{h} ( h n 1 − 1 ) classifiers voting for the correct label, excluding i i i and multiplying it by ∣ S ( k − 1 , h , m ) ∣ |S(k-1,h,m)| ∣ S ( k − 1 , h , m ) ∣ . Therefore, this corresponds to sets S ∈ S 1 S \in S_1 S ∈ S 1 where there are h h h classifiers voting for the correct label, k k k labels attaining h h h votes over p ( S ) p(S) p ( S ) and all remaining labels having strictly less than h h h votes. Finally, by the definition of ∣ S ( k − 1 , h , m ) ∣ |S(k-1,h,m)| ∣ S ( k − 1 , h , m ) ∣ each set has exactly cardinality ( m + h + 1 ) (m+h+1) ( m + h + 1 ) . Combining all the above each set must be weighted η ( m + h + 1 ) ( k − 1 ) / k \eta(m+h+1)(k-1)/k η ( m + h + 1 ) ( k − 1 ) / k to retain correctness. Eq. (25) follows by re-indexing the summations. Eq. (26) follows by grouping the two summations. Finally, Eq. (27) follows by the definition of f 1 ( k , h , m ) f_1(k,h,m) f 1 ( k , h , m ) combined with Lemma C.5.
Incorrect classifier (C i ( x ) = y j C_i(x)=y_j C i ( x ) = y j , j ≠ 1 j\ne1 j = 1 ). We now let S 3 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ ≥ 2 , p 1 ( S − i ) = p j ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i ) } S_3=\{S\subseteq[n]:i\in S,S-i\ne\emptyset,|\mathcal{M}(S-i)|\ge2,p_1(S-i)=p_j(S-i)=p_{j'}(S-i),j'\in\mathcal{M}(S-i)\} S 3 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ ≥ 2 , p 1 ( S − i ) = p j ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i )} , and S 4 = { S ⊆ [ n ] : i ∈ S , S − i ≠ ∅ , ∣ M ( S − i ) ∣ ≥ 1 , p j ( S − i ) + 1 = p 1 ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i ) } S_4=\{S\subseteq[n]:i\in S,S-i\ne\emptyset,|\mathcal{M}(S-i)|\ge1,p_j(S-i)+1=p_1(S-i)=p_{j'}(S-i),j'\in\mathcal{M}(S-i)\} S 4 = { S ⊆ [ n ] : i ∈ S , S − i = ∅ , ∣ M ( S − i ) ∣ ≥ 1 , p j ( S − i ) + 1 = p 1 ( S − i ) = p j ′ ( S − i ) , j ′ ∈ M ( S − i )} .
− ϕ i = − ∑ i ∈ S ⊆ C η ( ∣ S ∣ ) ( v ( S ) − v ( S − i ) ) (28) -\phi_i=-\sum_{i\in S\subseteq C}\eta(|S|)(v(S)-v(S-i)) \tag*{(28)} − ϕ i = − i ∈ S ⊆ C ∑ η ( ∣ S ∣ ) ( v ( S ) − v ( S − i )) (28)
= ∑ S ∈ S 3 η ( ∣ S ∣ ) ∣ M ( S − i ) ∣ + ∑ S ∈ S 4 η ( ∣ S ∣ ) ∣ M ( S − i ) ∣ ( ∣ M ( S − i ) ∣ + 1 ) (29) =\sum_{S\in S_3}\frac{\eta(|S|)}{|\mathcal{M}(S-i)|}+\sum_{S\in S_4}\frac{\eta(|S|)}{|\mathcal{M}(S-i)|(|\mathcal{M}(S-i)|+1)} \tag*{(29)} = S ∈ S 3 ∑ ∣ M ( S − i ) ∣ η ( ∣ S ∣ ) + S ∈ S 4 ∑ ∣ M ( S − i ) ∣ ( ∣ M ( S − i ) ∣ + 1 ) η ( ∣ S ∣ ) (29)
= ∑ k = 2 ℓ ∑ h = 1 n j − 1 ∑ m = h ( k − 2 ) n − ( n 1 + n j ) 1 k η ( m + 2 h + 1 ) ( n 1 h ) ( n j − 1 h ) ∣ S − j ( k − 2 , h , m ) ∣ + ∑ k = 1 ℓ − 1 ∑ h = 0 n j − 1 ∑ m = ( k − 1 ) ( h + 1 ) n − ( n 1 + n j ) 1 k ( k + 1 ) η ( m + 2 ( h + 1 ) ) ( n 1 h + 1 ) ( n j − 1 h ) ∣ S − j ( k − 1 , h + 1 , m ) ∣ (30) \begin{aligned}
={}&\sum_{k=2}^{\ell}\sum_{h=1}^{n_j-1}\sum_{m=h(k-2)}^{n-(n_1+n_j)}\frac{1}{k}\eta(m+2h+1)\binom{n_1}{h}\binom{n_j-1}{h}|S_{-j}(k-2,h,m)|\\
&+\sum_{k=1}^{\ell-1}\sum_{h=0}^{n_j-1}\sum_{m=(k-1)(h+1)}^{n-(n_1+n_j)}\frac{1}{k(k+1)}\eta(m+2(h+1))\binom{n_1}{h+1}\binom{n_j-1}{h}|S_{-j}(k-1,h+1,m)| \tag*{(30)}
\end{aligned} = k = 2 ∑ ℓ h = 1 ∑ n j − 1 m = h ( k − 2 ) ∑ n − ( n 1 + n j ) k 1 η ( m + 2 h + 1 ) ( h n 1 ) ( h n j − 1 ) ∣ S − j ( k − 2 , h , m ) ∣ + k = 1 ∑ ℓ − 1 h = 0 ∑ n j − 1 m = ( k − 1 ) ( h + 1 ) ∑ n − ( n 1 + n j ) k ( k + 1 ) 1 η ( m + 2 ( h + 1 )) ( h + 1 n 1 ) ( h n j − 1 ) ∣ S − j ( k − 1 , h + 1 , m ) ∣ (30)
= ∑ k = 0 ℓ − 2 ∑ h = 0 n j − 1 ∑ m = h k n − ( n 1 + n j ) 1 k + 2 η ( m + 2 h + 1 ) ( n 1 h ) ( n j − 1 h ) ∣ S − j ( k , h , m ) ∣ + ∑ k = 0 ℓ − 2 ∑ h = 1 n j ∑ m = h k n − ( n 1 + n j ) 1 ( k + 1 ) ( k + 2 ) η ( m + 2 h ) ( n 1 h ) ( n j − 1 h − 1 ) ∣ S − j ( k , h , m ) ∣ (31) \begin{aligned}
={}&\sum_{k=0}^{\ell-2}\sum_{h=0}^{n_j-1}\sum_{m=hk}^{n-(n_1+n_j)}\frac{1}{k+2}\eta(m+2h+1)\binom{n_1}{h}\binom{n_j-1}{h}|S_{-j}(k,h,m)|\\
&+\sum_{k=0}^{\ell-2}\sum_{h=1}^{n_j}\sum_{m=hk}^{n-(n_1+n_j)}\frac{1}{(k+1)(k+2)}\eta(m+2h)\binom{n_1}{h}\binom{n_j-1}{h-1}|S_{-j}(k,h,m)| \tag*{(31)}
\end{aligned} = k = 0 ∑ ℓ − 2 h = 0 ∑ n j − 1 m = hk ∑ n − ( n 1 + n j ) k + 2 1 η ( m + 2 h + 1 ) ( h n 1 ) ( h n j − 1 ) ∣ S − j ( k , h , m ) ∣ + k = 0 ∑ ℓ − 2 h = 1 ∑ n j m = hk ∑ n − ( n 1 + n j ) ( k + 1 ) ( k + 2 ) 1 η ( m + 2 h ) ( h n 1 ) ( h − 1 n j − 1 ) ∣ S − j ( k , h , m ) ∣ (31)
= ∑ k = 0 ℓ − 2 ∑ h = 1 n j ∑ m = h k n − ( n 1 + n j ) f j ( k , h , m ) [ t k u m ] P h ( t , u ) A j ( h ; u ) + B j ( h ; u ) t (32) =\sum_{k=0}^{\ell-2}\sum_{h=1}^{n_j}\sum_{m=hk}^{n-(n_1+n_j)}f_j(k,h,m)[t^k u^m]\frac{P_h(t,u)}{A_j(h;u)+B_j(h;u)t} \tag*{(32)} = k = 0 ∑ ℓ − 2 h = 1 ∑ n j m = hk ∑ n − ( n 1 + n j ) f j ( k , h , m ) [ t k u m ] A j ( h ; u ) + B j ( h ; u ) t P h ( t , u ) (32)
{#eq:33}
where Eq. (28) follows by Eq. (1) . Eq. (29) follows by Lemma C.2 and the definitions of S 3 S_3 S 3 and S 4 S_4 S 4 . Eq. (30) follows by a combinatorial selection of the sets in S 3 S_3 S 3 and S 4 S_4 S 4 , with an analogous argument detailed for the case of correct classifiers, combined with the definition of ∣ S − j ( k , h , m ) ∣ |S_{-j}(k,h,m)| ∣ S − j ( k , h , m ) ∣ . Eq. (31) follows by re-indexing the summations. Finally, Eq. (32) follows by grouping the two summations noting that ( n j − 1 n j ) = 0 \binom{n_j-1}{n_j}=0 ( n j n j − 1 ) = 0 , the definition of f j f_j f j , j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] and Corollary C.6. □
Proof of Theorem 4.9. As shown in the proof of Theorem 4.7 we only need to compute the values of ϕ i \phi_i ϕ i for all classifiers i ∈ [ n ] i\in[n] i ∈ [ n ] yielding a unique vote profile p ∈ U \mathbf{p}\in U p ∈ U , by symmetry.
Fix a data point ( x , y ) (x,y) ( x , y ) the our Algorithm 4 first evaluates the predictions of all classifiers in O ( n ) O(n) O ( n ) time, and applies the mapping such that y = y 1 y=y_1 y = y 1 in O ( ℓ ) O(\ell) O ( ℓ ) time. Note that any label y j y_j y j with n j = 0 n_j=0 n j = 0 can be ignored, since A j ( h ; u ) = 1 A_j(h;u)=1 A j ( h ; u ) = 1 and B j ( h ; u ) = 0 B_j(h;u)=0 B j ( h ; u ) = 0 for h ≥ 1 h\ge1 h ≥ 1 , i.e., its factor in P h ( t , u ) P_h(t,u) P h ( t , u ) is 1 1 1 . Thus, we assume n j ≥ 1 n_j\ge1 n j ≥ 1 for j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] . Algorithm 4 then iterates over h ∈ [ n 1 ] h\in[n_1] h ∈ [ n 1 ] initializing a matrix P h P_h P h of size ℓ × ( n − n 1 + 1 ) \ell\times(n-n_1+1) ℓ × ( n − n 1 + 1 ) , which contains the coefficient of the polynomial P h ( t , u ) P_h(t,u) P h ( t , u ) . All matrices P h P_h P h , h ≥ 1 h\ge1 h ≥ 1 can be computed within a time complexity bounded by
Figure 1. ENPOWERB _{\mathrm{B}} B : exact computation of Banzhaf and Shapley values for binary classifiers. Input: ψ ∈ { β , ϕ } \psi\in\{\beta,\phi\} ψ ∈ { β , ϕ } ; ensemble C = { C 1 , … , C n } \mathcal{C}=\{C_1,\ldots,C_n\} C = { C 1 , … , C n } ; dataset D \mathcal{D} D . 1 for i ∈ [ n ] i \in[n] i ∈ [ n ] do ψ i ( G D ) ← 0 \psi_i(G_{\mathcal{D}})\leftarrow0 ψ i ( G D ) ← 0 ; 2 foreach ( x , y ) ∈ D (x,y)\in\mathcal{D} ( x , y ) ∈ D do 3 n + ← ∑ C ∈ C 1 [ C ( x ) = y ] n_+\leftarrow\sum_{C\in\mathcal{C}}\mathbf{1}[C(x)=y] n + ← ∑ C ∈ C 1 [ C ( x ) = y ] ; 4 for i ← 1 i\leftarrow1 i ← 1 to n n n do 5 ψ i ( G D ) ← ψ i ( G D ) + Get ψ ( n , n + , C i ( x ) , y ) \psi_i(G_{\mathcal{D}})\leftarrow\psi_i(G_{\mathcal{D}})+\operatorname{Get}_{\psi}(n,n_+,C_i(x),y) ψ i ( G D ) ← ψ i ( G D ) + Get ψ ( n , n + , C i ( x ) , y ) ; 6 return { ψ i ( G D ) ∣ D ∣ } i ∈ [ n ] \left\{\frac{\psi_i(G_{\mathcal{D}})}{|\mathcal{D}|}\right\}_{i\in[n]} { ∣ D ∣ ψ i ( G D ) } i ∈ [ n ]
∑ h = 1 n 1 ∑ j = 2 ℓ ∑ i = 0 j − 2 ∑ m = 0 ∑ j ′ = 2 j − 1 n j ′ O ( min ( n j , h ) ) ≤ ∑ h = 1 n 1 ∑ j = 2 ℓ O ( ℓ ( n − n 1 ) n j ) = O ( n 1 ℓ ( n − n 1 ) ) ∑ j = 2 ℓ n j = O ( n 1 ℓ ( n − n 1 ) 2 ) = O ( ℓ n 3 ) , \sum_{h=1}^{n_1}\sum_{j=2}^{\ell}\sum_{i=0}^{j-2}\sum_{m=0}^{\sum_{j'=2}^{j-1}n_{j'}} O(\min(n_j,h)) \leq\sum_{h=1}^{n_1}\sum_{j=2}^{\ell} O(\ell(n-n_1)n_j)
= O(n_1\ell(n-n_1))\sum_{j=2}^{\ell}n_j
= O(n_1\ell(n-n_1)^2)=O(\ell n^3), h = 1 ∑ n 1 j = 2 ∑ ℓ i = 0 ∑ j − 2 m = 0 ∑ ∑ j ′ = 2 j − 1 n j ′ O ( min ( n j , h )) ≤ h = 1 ∑ n 1 j = 2 ∑ ℓ O ( ℓ ( n − n 1 ) n j ) = O ( n 1 ℓ ( n − n 1 )) j = 2 ∑ ℓ n j = O ( n 1 ℓ ( n − n 1 ) 2 ) = O ( ℓ n 3 ) ,
where the first step follows by the independence of the summations on m m m and i i i , and by the facts that j − 2 ≤ ℓ j-2\leq\ell j − 2 ≤ ℓ ; ∑ j ′ = 2 j − 1 n j ′ ≤ ∑ j ′ = 2 ℓ n j ′ = n − n 1 \sum_{j'=2}^{j-1}n_{j'}\leq\sum_{j'=2}^{\ell}n_{j'}=n-n_1 ∑ j ′ = 2 j − 1 n j ′ ≤ ∑ j ′ = 2 ℓ n j ′ = n − n 1 ; and that min ( a , b ) ≤ a \min(a,b)\leq a min ( a , b ) ≤ a . The first equality follows by the linearity of the sum, and the second equality follows again by ∑ j ′ = 2 ℓ n j ′ = n − n 1 \sum_{j'=2}^{\ell}n_{j'}=n-n_1 ∑ j ′ = 2 ℓ n j ′ = n − n 1 . Clearly the last step bounds ( n − n 1 ) ≤ n (n-n_1)\leq n ( n − n 1 ) ≤ n and n 1 ≤ n n_1\leq n n 1 ≤ n . For each matrix P h P_h P h the algorithm computes the Shapley values of a correct classifier in O ( ℓ n ) O(\ell n) O ( ℓ n ) time, using the result of Theorem 4.8 . For each incorrect label, the algorithm computes the coefficients of the polynomial Q j ( t , u ) ≔ P h ( t , u ) / ( A j ( h ; u ) + B j ( h ; u ) t ) Q_j(t,u)\coloneqq P_h(t,u)/(A_j(h;u)+B_j(h;u)t) Q j ( t , u ) : = P h ( t , u ) / ( A j ( h ; u ) + B j ( h ; u ) t ) updating the matrix P h P_h P h in place with a time complexity bounded by O ( ℓ ( n − n 1 ) n j ) O(\ell(n-n_1)n_j) O ( ℓ ( n − n 1 ) n j ) , it then computes the related Shapley value in O ( ℓ n ) = O ( ℓ n n j ) O(\ell n)=O(\ell n n_j) O ( ℓ n ) = O ( ℓ n n j ) time, and it then restores the matrix P h P_h P h adding class j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] in O ( ℓ ( n − n 1 ) n j ) O(\ell(n-n_1)n_j) O ( ℓ ( n − n 1 ) n j ) time. Therefore, summing over j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] and using ∑ j = 2 ℓ n j = n − n 1 \sum_{j=2}^{\ell}n_j=n-n_1 ∑ j = 2 ℓ n j = n − n 1 , we obtain a time complexity bounded by O ( ℓ n 2 ) O(\ell n^2) O ( ℓ n 2 ) time for each h h h , and O ( ℓ n 3 ) O(\ell n^3) O ( ℓ n 3 ) over all h ∈ [ n 1 ] h\in[n_1] h ∈ [ n 1 ] . Therefore, the time complexity of Algorithm 4 is bounded by O ( ∣ U ∣ n 3 ℓ + ∣ D ∣ n ) O(|U|n^3\ell+|D|n) O ( ∣ U ∣ n 3 ℓ + ∣ D ∣ n ) . The memory complexity is bounded by O ( ∣ U ∣ ℓ + ℓ n ) = O ( ℓ ( ∣ U ∣ + n ) ) O(|U|\ell+\ell n)=O(\ell(|U|+n)) O ( ∣ U ∣ ℓ + ℓ n ) = O ( ℓ ( ∣ U ∣ + n )) .
Pseudocode
Binary classification
Computation of Banzhaf and Shapley values. Pseudocode for our main algorithm, which is presented in § 4.1 , is shown in Algorithm 1,
We detail the missing subroutine Get ψ \operatorname{Get}_{\psi} Get ψ of Algorithm 1 in Algorithm 2. That is, Algorithm 2 simply computes the Banzhaf (when ψ = β \psi=\beta ψ = β ) or Shapley (when ψ = ϕ \psi=\phi ψ = ϕ ) according to Theorem 4.1 and Theorem 4.2 respectively.
We remark that in practice we do not execute the loop in Algorithm 1 of Algorithm 1. That is, we need to execute Get ψ \operatorname{Get}_{\psi} Get ψ exactly twice for any point ( x , y ) ∈ D (x,y)\in\mathcal{D} ( x , y ) ∈ D of the dataset D \mathcal{D} D : the first execution is to obtain the values of the power index on v B ( x ) v_{\mathrm{B}}(x) v B ( x ) for all correct models and the second execution is to obtain the remaining values. That is, by symmetry all correct models will have the same power index on the game G = ( C , v B ( x ) ) G=(\mathcal{C},v_{\mathrm{B}}(x)) G = ( C , v B ( x )) , and similarly for all the incorrect models. We discuss how to implement efficiently our method in Sec. E.
Multiclass classification
Banzhaf computation over v M C v_{\mathrm{MC}} v MC (ENPOWERM C _{\mathrm{MC}} MC -β \beta β ). We detail the pseudocode of our approach that computes the values of β i ( G D ) \beta_i(G_{\mathcal{D}}) β i ( G D ) in Algorithm 3. The algorithm proceeds by processing each element independently in the loop from Algorithm 3. It applies the relabeling discussed in § 4.2 Algorithm 2: Get-β ( n , n + , C i ( x ) , y ) \beta(n,n_{+},C_i(x),y) β ( n , n + , C i ( x ) , y ) and Get-ϕ ( n , n + , C i ( x ) , y ) \phi(n,n_{+},C_i(x),y) ϕ ( n , n + , C i ( x ) , y )
Input: number of classifiers n n n , number of correct predictions n + n_{+} n + , prediction C i ( x ) C_i(x) C i ( x ) , label y y y
Procedure Get-β ( n , n + , C i ( x ) , y ) \beta(n,n_{+},C_i(x),y) β ( n , n + , C i ( x ) , y )
n − ← n − n + n_{-} \leftarrow n-n_{+} n − ← n − n + ;
if C i ( x ) = y C_i(x)=y C i ( x ) = y then
return ( ( n n − ) + 1 ) 2 − n \left(\binom{n}{n_{-}}+1\right)2^{-n} ( ( n − n ) + 1 ) 2 − n ;
else
return − ( ( n n + ) − 1 ) 2 − n -\left(\binom{n}{n_{+}}-1\right)2^{-n} − ( ( n + n ) − 1 ) 2 − n ;
Procedure Get-ϕ ( n , n + , C i ( x ) , y ) \phi(n,n_{+},C_i(x),y) ϕ ( n , n + , C i ( x ) , y )
a ← 0 a\leftarrow0 a ← 0 ; b ← 0 b\leftarrow0 b ← 0 ; ϕ i ← 0 \phi_i\leftarrow0 ϕ i ← 0 ;
if C i ( x ) = y C_i(x)=y C i ( x ) = y then
a ← ( n − 2 n + ) ! ( 2 n + − 1 ) ! n ! ( n n + ) a\leftarrow\frac{(n-2n_{+})!(2n_{+}-1)!}{n!}\binom{n}{n_{+}} a ← n ! ( n − 2 n + )! ( 2 n + − 1 )! ( n + n ) ;
b ← min { n − , n + − 1 } b\leftarrow\min\{n_{-},n_{+}-1\} b ← min { n − , n + − 1 } ;
ϕ i ← 1 n + 1 2 ( a + ∑ h = 1 b ( n + − 1 h − 1 ) ( n − h ) ( n − 2 h − 1 ) ! ( 2 h − 1 ) ! n ! ( 2 n + + n − 4 h ) ) \phi_i\leftarrow\frac{1}{n}+\frac{1}{2}\left(a+\sum_{h=1}^{b}\binom{n_{+}-1}{h-1}\binom{n_{-}}{h}\frac{(n-2h-1)!(2h-1)!}{n!}(2n_{+}+n-4h)\right) ϕ i ← n 1 + 2 1 ( a + ∑ h = 1 b ( h − 1 n + − 1 ) ( h n − ) n ! ( n − 2 h − 1 )! ( 2 h − 1 )! ( 2 n + + n − 4 h ) ) ;
else
a ← ( n − 2 n − ) ! ( 2 n − − 1 ) ! n ! ( n n + ) a\leftarrow\frac{(n-2n_{-})!(2n_{-}-1)!}{n!}\binom{n}{n_{+}} a ← n ! ( n − 2 n − )! ( 2 n − − 1 )! ( n + n ) ;
b ← min { n + , n − − 1 } b\leftarrow\min\{n_{+},n_{-}-1\} b ← min { n + , n − − 1 } ;
ϕ i ← − 1 2 ( a + ∑ h = 1 b ( n − − 1 h − 1 ) ( n + h ) ( n − 2 h − 1 ) ! ( 2 h − 1 ) ! n ! ( 2 n − + n − 4 h ) ) \phi_i\leftarrow-\frac{1}{2}\left(a+\sum_{h=1}^{b}\binom{n_{-}-1}{h-1}\binom{n_{+}}{h}\frac{(n-2h-1)!(2h-1)!}{n!}(2n_{-}+n-4h)\right) ϕ i ← − 2 1 ( a + ∑ h = 1 b ( h − 1 n − − 1 ) ( h n + ) n ! ( n − 2 h − 1 )! ( 2 h − 1 )! ( 2 n − + n − 4 h ) ) ;
return ϕ i \phi_i ϕ i ;
from Algorithm 3 to Algorithm 3, setting class 1 as the correct one and all the remaining classes as incorrect ones, we use D [ ⋅ ] D[\cdot] D [ ⋅ ] to denote a dictionary data structure. The main loop of the algorithm from Algorithm 3 simply computes the power indices as dictated by Theorem 4.6 . Note that, while obtaining the coefficients of P h P_h P h , with our approach, requires O ( ℓ 2 ) O(\ell^2) O ( ℓ 2 ) (Algorithm 3), we compute the term A j ( h ) A_j(h) A j ( h ) (Algorithm 3) using A j − 1 ( h ) A_{j-1}(h) A j − 1 ( h ) , i.e., avoiding to recompute the summation for each value of h h h . The loop in Algorithm 3 computes the Banzhaf values for all incorrect models, according to the class they voted to. We then update the Banzhaf values of each model in Algorithm 3 according to the class for which each model voted. The final output in Algorithm 3 reports the average of the values as captured by the definition of G D \mathcal{G}_D G D .
Note that our actual implementation does not compute the power indices β i \beta_i β i all points in D D D as we apply the symmetry property to process only the points in D D D yielding unique vote profiles as discussed in § 3 . We detail how to process only the unique vote profiles in the pseudocode of ENPOWERMC-ϕ \phi ϕ that we will discuss next.
Shapley computation over v M C v_{\mathrm{MC}} v MC (ENPOWERMC-ϕ \phi ϕ ). Algorithm 4 displays the pseudocode of ENPOWERMC-ϕ \phi ϕ computing the Shapley values for the multiclass case implementing our theoretical results of Theorem 4.8 .
The algorithm is similar to Algorithm 3, while slightly more complex due to the introduction of the bivariate polynomial from Theorem 4.8 . We now detail the main differences with respect to Algorithm 3. First, as mentioned previously, and as captured by our theoretical results we need to compute the Shapley values only for the points yielding unique vote profiles. To do so, we use a dictionary J u n i q u e J_{\mathrm{unique}} J unique (Algorithm 4) which caches the vote profiles seen so far and the Shapley values for the specific game (Algorithm 4). If the vote profile has been observed we can simply use the cached values, and update the global Shapley values of all points (Algorithm 4 and Algorithm 4). Otherwise the algorithm processes the vote profile, by implementing Theorem 4.8 . In Algorithm 4 we compute P h P_h P h with a dynamic programming approach storing the coefficients of the bivariate polynomial necessary to compute the Shapley values for all models.
The dynamic programming approach is detailed in Algorithm 5. Such approach computes a matrix P h [ k , m ] P_h[k,m] P h [ k , m ] containing all coefficients of the bivariate polynomial P h ( t , u ) P_h(t,u) P h ( t , u ) . That is, each row $k \in [ 0 , ℓ − 1 ] [0,\ell-1] [ 0 , ℓ − 1 ] will correspond to the coefficients of the polynomial in u u u after the extraction of the k k k -th coefficient in t t t (i.e., [ t k ] P h ( t , u ) [t^k]P_h(t,u) [ t k ] P h ( t , u ) ). In other words, the entry P h [ k , m ] P_h[k,m] P h [ k , m ] contains the counts of all coalitions of S ( k , h , m ) S(k,h,m) S ( k , h , m ) . The algorithm processes one incorrect class j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] at a time, computing the number of sets that such class contributes towards the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) . To detail the recursion used by the algorithm, for j ∈ [ ℓ ] j \in[\ell] j ∈ [ ℓ ] let6
P h ( j ) ( t , u ) ≔ ∏ j ′ = 2 j ( A j ′ ( h ; u ) + B j ′ ( h ; u ) t ) , P_h^{(j)}(t,u) \coloneqq\prod_{j'=2}^{j}\left(A_{j'}(h;u)+B_{j'}(h;u)t\right), P h ( j ) ( t , u ) : = j ′ = 2 ∏ j ( A j ′ ( h ; u ) + B j ′ ( h ; u ) t ) ,
be the partial product over the first j − 1 j-1 j − 1 incorrect classes (arbitrarily labelled). We define P h ( 1 ) ( t , u ) = 1 P_h^{(1)}(t,u)=1 P h ( 1 ) ( t , u ) = 1 to correspond to the empty product. Note that P h ( ℓ ) ( t , u ) = P h ( t , u ) P_h^{(\ell)}(t,u)=P_h(t,u) P h ( ℓ ) ( t , u ) = P h ( t , u ) . We also let n ( j ) = ∑ j ′ = 2 j n j ′ n^{(j)}=\sum_{j'=2}^{j}n_{j'} n ( j ) = ∑ j ′ = 2 j n j ′ be the number of classifiers voting for one of such classes. The next lemma formalizes the recursion used in Algorithm 5, and proves its correctness.
Lemma D.1. Fix h ≥ 1 h\ge1 h ≥ 1 , for j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , k ∈ [ 0 , ℓ − 1 ] k\in[0,\ell-1] k ∈ [ 0 , ℓ − 1 ] and m ∈ [ 0 , n ( j ) ] m\in[0,n^{(j)}] m ∈ [ 0 , n ( j ) ] , let
P h ( j ) [ k , m ] = ∑ q = 0 min ( n j , h − 1 , m ) ( n j q ) P h ( j − 1 ) [ k , m − q ] + 1 [ k ≥ 1 ∧ m ≥ h ] ( n j h ) P h ( j − 1 ) [ k − 1 , m − h ] , (33) P_h^{(j)}[k,m]=\sum_{q=0}^{\min(n_j,h-1,m)}\binom{n_j}{q}P_h^{(j-1)}[k,m-q]+\mathbf{1}[k\ge1\wedge m\ge h]\binom{n_j}{h}P_h^{(j-1)}[k-1,m-h], \tag*{(33)} P h ( j ) [ k , m ] = q = 0 ∑ m i n ( n j , h − 1 , m ) ( q n j ) P h ( j − 1 ) [ k , m − q ] + 1 [ k ≥ 1 ∧ m ≥ h ] ( h n j ) P h ( j − 1 ) [ k − 1 , m − h ] , (33) where P h ( 1 ) [ k , m ] = 1 [ k = 0 ∧ m = 0 ] P_h^{(1)}[k,m]=\mathbf{1}[k=0\wedge m=0] P h ( 1 ) [ k , m ] = 1 [ k = 0 ∧ m = 0 ] , and P h ( j ) [ k , m ] = 0 P_h^{(j)}[k,m]=0 P h ( j ) [ k , m ] = 0 for m > n ( j ) m>n^{(j)} m > n ( j ) , as P h ( j ) ( t , u ) P_h^{(j)}(t,u) P h ( j ) ( t , u ) has degree at most n ( j ) n^{(j)} n ( j ) in u u u . Then, for each j = 1 , … , ℓ j=1,\ldots,\ell j = 1 , … , ℓ , k ∈ [ 0 , ℓ − 1 ] k\in[0,\ell-1] k ∈ [ 0 , ℓ − 1 ] and m ∈ [ 0 , n ( j ) ] m\in[0,n^{(j)}] m ∈ [ 0 , n ( j ) ] it holds that
P h ( j ) [ k , m ] = [ t k u m ] P h ( j ) ( t , u ) . P_h^{(j)}[k,m]=[t^ku^m]P_h^{(j)}(t,u). P h ( j ) [ k , m ] = [ t k u m ] P h ( j ) ( t , u ) .
Proof. We proceed by induction on j ≥ 1 j\ge1 j ≥ 1 , i.e., the number of incorrect classes evaluated by the recursion.
Base case (j = 1 j=1 j = 1 ). By definition P h ( 1 ) ( t , u ) P_h^{(1)}(t,u) P h ( 1 ) ( t , u ) is the empty product, i.e., P h ( 1 ) ( t , u ) = 1 = t 0 u 0 P_h^{(1)}(t,u)=1=t^0u^0 P h ( 1 ) ( t , u ) = 1 = t 0 u 0 . Therefore, for each k ∈ [ 0 , ℓ − 1 ] k\in[0,\ell-1] k ∈ [ 0 , ℓ − 1 ] and m ≥ 0 m\ge0 m ≥ 0 it holds that [ t k u m ] P h ( 1 ) ( t , u ) = 1 [ k = 0 ∧ m = 0 ] = P h ( 1 ) [ k , m ] [t^ku^m]P_h^{(1)}(t,u)=\mathbf{1}[k=0\wedge m=0]=P_h^{(1)}[k,m] [ t k u m ] P h ( 1 ) ( t , u ) = 1 [ k = 0 ∧ m = 0 ] = P h ( 1 ) [ k , m ] .
Inductive step. Fix j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] and assume that P h ( j − 1 ) [ k , m ] = [ t k u m ] P h ( j − 1 ) ( t , u ) P_h^{(j-1)}[k,m]=[t^ku^m]P_h^{(j-1)}(t,u) P h ( j − 1 ) [ k , m ] = [ t k u m ] P h ( j − 1 ) ( t , u ) holds for each k ∈ [ 0 , ℓ − 1 ] k\in[0,\ell-1] k ∈ [ 0 , ℓ − 1 ] and m ≥ 0 m\ge0 m ≥ 0 , where both sides equal 0 0 0 for m > n ( j − 1 ) m>n^{(j-1)} m > n ( j − 1 ) , since P h ( j − 1 ) ( t , u ) P_h^{(j-1)}(t,u) P h ( j − 1 ) ( t , u ) has degree at most n ( j − 1 ) n^{(j-1)} n ( j − 1 ) in u u u . By definition of P h ( j ) ( t , u ) P_h^{(j)}(t,u) P h ( j ) ( t , u ) we have P h ( j ) ( t , u ) = P h ( j − 1 ) ( t , u ) ( A j ( h ; u ) + B j ( h ; u ) t ) P_h^{(j)}(t,u)=P_h^{(j-1)}(t,u)\left(A_j(h;u)+B_j(h;u)t\right) P h ( j ) ( t , u ) = P h ( j − 1 ) ( t , u ) ( A j ( h ; u ) + B j ( h ; u ) t ) . Note that terms A j ( h ; u ) A_j(h;u) A j ( h ; u ) and B j ( h ; u ) B_j(h;u) B j ( h ; u ) do not depend on t t t , and thus for k ∈ [ 0 , ℓ − 1 ] k\in[0,\ell-1] k ∈ [ 0 , ℓ − 1 ] extracting the coefficient of t k t^k t k yields
[ t k ] P h ( j ) ( t , u ) = A j ( h ; u ) [ t k ] P h ( j − 1 ) ( t , u ) + B j ( h ; u ) [ t k − 1 ] P h ( j − 1 ) ( t , u ) , [t^k]P_h^{(j)}(t,u)=A_j(h;u)[t^k]P_h^{(j-1)}(t,u)+B_j(h;u)[t^{k-1}]P_h^{(j-1)}(t,u), [ t k ] P h ( j ) ( t , u ) = A j ( h ; u ) [ t k ] P h ( j − 1 ) ( t , u ) + B j ( h ; u ) [ t k − 1 ] P h ( j − 1 ) ( t , u ) ,
where the second term is 0 0 0 when k = 0 k=0 k = 0 . First note that each of the above terms is a polynomial in u u u . Thus, let m ∈ [ 0 , n ( j ) ] m\in[0,n^{(j)}] m ∈ [ 0 , n ( j ) ] , we now extract the coefficient of u m u^m u m from each of the two terms above. Considering the first term, we have
[ u m ] ( A j ( h ; u ) [ t k ] P h ( j − 1 ) ( t , u ) ) = ∑ q = 0 h − 1 ( n j q ) [ t k u m − q ] P h ( j − 1 ) ( t , u ) = ∑ q = 0 min ( n j , h − 1 , m ) ( n j q ) P h ( j − 1 ) [ k , m − q ] , \begin{aligned}
[u^m]\left(A_j(h;u)[t^k]P_h^{(j-1)}(t,u)\right)
=\sum_{q=0}^{h-1}\binom{n_j}{q}[t^ku^{m-q}]P_h^{(j-1)}(t,u) \\
&=\sum_{q=0}^{\min(n_j,h-1,m)}\binom{n_j}{q}P_h^{(j-1)}[k,m-q],
\end{aligned} [ u m ] ( A j ( h ; u ) [ t k ] P h ( j − 1 ) ( t , u ) ) = q = 0 ∑ h − 1 ( q n j ) [ t k u m − q ] P h ( j − 1 ) ( t , u ) = q = 0 ∑ m i n ( n j , h − 1 , m ) ( q n j ) P h ( j − 1 ) [ k , m − q ] ,
the first equality follows by the definition of A j ( h ; u ) A_j(h;u) A j ( h ; u ) and the Cauchy product. The last equality uses the inductive hypothesis and ignores zero terms, that is: (a) terms with q > m q>m q > m , since m − q < 0 m-q<0 m − q < 0 and the polynomial P h ( j − 1 ) ( t , u ) P_h^{(j-1)}(t,u) P h ( j − 1 ) ( t , u ) has only monomials of non-negative degree in u u u ; and (b) terms with q > n j q>n_j q > n j , since ( n j q ) = 0 \binom{n_j}{q}=0 ( q n j ) = 0 . For the second term, since B j ( h ; u ) = ( n j h ) u h B_j(h;u)=\binom{n_j}{h}u^h B j ( h ; u ) = ( h n j ) u h , the multiplication by u h u^h u h increases by exactly h h h the degree in u u u of each monomial of P h ( j − 1 ) ( t , u ) P_h^{(j-1)}(t,u) P h ( j − 1 ) ( t , u ) . Therefore, the extraction of [ u m ] [u^m] [ u m ] corresponds to extracting [ u m − h ] [u^{m-h}] [ u m − h ] from P h ( j − 1 ) ( t , u ) P_h^{(j-1)}(t,u) P h ( j − 1 ) ( t , u ) , hence
[ u m ] ( B j ( h ; u ) [ t k − 1 ] P h ( j − 1 ) ( t , u ) ) = ( n j h ) [ t k − 1 u m − h ] P h ( j − 1 ) ( t , u ) = ( n j h ) P h ( j − 1 ) [ k − 1 , m − h ] , [u^m]\left(B_j(h;u)[t^{k-1}]P_h^{(j-1)}(t,u)\right)
= \binom{n_j}{h}[t^{k-1}u^{m-h}]P_h^{(j-1)}(t,u)
= \binom{n_j}{h}P_h^{(j-1)}[k-1,m-h], [ u m ] ( B j ( h ; u ) [ t k − 1 ] P h ( j − 1 ) ( t , u ) ) = ( h n j ) [ t k − 1 u m − h ] P h ( j − 1 ) ( t , u ) = ( h n j ) P h ( j − 1 ) [ k − 1 , m − h ] ,
using the inductive hypothesis. Note that the above term equals 0 0 0 for m < h m<h m < h , and for n j < h n_j<h n j < h since ( n j h ) = 0 \binom{n_j}{h}=0 ( h n j ) = 0 . Summing the two terms yields the right-hand side of Eq. (33) , that is
[ t k u m ] P h ( j ) ( t , u ) = P h ( j ) [ k , m ] , [t^k u^m]P_h^{(j)}(t,u)=P_h^{(j)}[k,m], [ t k u m ] P h ( j ) ( t , u ) = P h ( j ) [ k , m ] ,
concluding the induction, and yielding the claim.
Note that by the above result we have P h ( ℓ ) [ k , m ] = ∣ S ( k , h , m ) ∣ P_h^{(\ell)}[k,m]=|S(k,h,m)| P h ( ℓ ) [ k , m ] = ∣ S ( k , h , m ) ∣ , since P h ( ℓ ) ( t , u ) = P h ( t , u ) P_h^{(\ell)}(t,u)=P_h(t,u) P h ( ℓ ) ( t , u ) = P h ( t , u ) and by Lemma C.5.
Algorithm 6 implements Eq. (33) in place, i.e., using a single matrix P h P_h P h , initialized to P h ( 1 ) P_h^{(1)} P h ( 1 ) by Algorithm 5. The term for q = 0 q=0 q = 0 in Eq. (33) equals P h ( j − 1 ) [ k , m ] P_h^{(j-1)}[k,m] P h ( j − 1 ) [ k , m ] , i.e., the current value of the entry, which is maintained in place. By Eq. (33) , the value of an entry [ k , m ] [k,m] [ k , m ] is obtained from the entries [ k , m − q ] [k,m-q] [ k , m − q ] for q ∈ [ 1 , min ( n j , h − 1 ) ] q\in[1,\min(n_j,h-1)] q ∈ [ 1 , min ( n j , h − 1 )] and [ k − 1 , m − h ] [k-1,m-h] [ k − 1 , m − h ] , i.e., from entries in the same row with a smaller column, or in a smaller row. Since the algorithm processes both rows and columns in decreasing order, these entries are processed after [ k , m ] [k,m] [ k , m ] , and thus each entry (when processed) holds its value for P h ( j − 1 ) P_h^{(j-1)} P h ( j − 1 ) when read, preserving the correctness of our result. Note that by reversing the recursion (e.g., see [42 ] ) we can remove any class in-place, as we do in Algorithm 7. We update the Shapley values ϕ i \phi_i ϕ i to be reported in output in Algorithm 4, and finally output the average values over D \mathcal{D} D (Algorithm 4). That is upon the computation of the coefficients of the polynomial P h ( t , u ) P_h(t,u) P h ( t , u ) our Algorithm 4 simply implements the result from Theorem 4.8 .
Note that in the loop computing the Shapley values for the incorrect classifiers (Algorithm 4), we modify in place the matrix P h [ k , m ] P_h[k,m] P h [ k , m ] , for a space efficient implementation, by safely removing classes as mentioned above using Algorithm 7.
We discuss in Sec. E how to implement our methods without incurring in numerical issues due to the presence of large binomial and factorial terms.
Monte-Carlo sampling baseline. We present our baseline MC in Algorithm 8. The algorithm takes in input a sample size s s s , the dataset D \mathcal{D} D and the ensemble C \mathcal{C} C . The algorithm process each model i ∈ [ n ] i\in[n] i ∈ [ n ] independently by sampling s s s coalitions S S S such that P [ S ] = 1 / 2 n − 1 \mathbb{P}[S]=1/2^{n-1} P [ S ] = 1/ 2 n − 1 for the Banzhaf value and P [ S ] = ( n − ∣ S ∣ ) ! ( ∣ S ∣ − 1 ) ! n ! \mathbb{P}[S]=\frac{(n-|S|)!(|S|-1)!}{n!} P [ S ] = n ! ( n − ∣ S ∣ )! ( ∣ S ∣ − 1 )! for the Shapley index. That is, such probability accounts for the weight of each marginal gain v ( S + i ) − v ( S ) v(S+i)-v(S) v ( S + i ) − v ( S ) in the respective power index, that is, the estimate is unbiased. The output averages across samples, and over the entire dataset D \mathcal{D} D the marginal contribution of v ( S + i ) − v ( S ) v(S+i)-v(S) v ( S + i ) − v ( S ) for all the s s s samples over each point. Since evaluating v ( S ) v(S) v ( S ) on a point requires evaluating all the votes of the sampled coalition with size bounded by n n n , the final complexity is O ( s n 2 ∣ D ∣ ) \mathcal{O}(sn^2|\mathcal{D}|) O ( s n 2 ∣ D ∣ ) . We remark that more advanced and sample efficient techniques exists, e.g., [31 ] . However, our baseline serves to show that a simple sampling algorithm is significantly more inaccurate and inefficient compared to our algorithms in ENPOWER.
Efficient and numerically stable implementation
In this section we briefly details about our practical implementation of ENPOWER. We highlight how we addressed specific issues regarding numerical stability and efficiency.
Banzhaf power index (ENPOWERB _B B ). For simplicity fix i ∈ [ n ] i\in[n] i ∈ [ n ] to be a correct classifier, an analogous discussion applies to incorrect classifiers. From Theorem 4.1 we can express the Banzhaf index as ( n − 2 n ) + ( 1 2 n ) \binom{n_-}{2^n}+\left(\frac{1}{2^n}\right) ( 2 n n − ) + ( 2 n 1 ) . Therefore, computing the Banzhaf index evaluating each individual term will yield to numerical issues, given by the large values attained by 2 n 2^n 2 n and by ( n n − ) \binom{n}{n_-} ( n − n ) . However, we observe that ( n n − ) / 2 n \binom{n}{n_-}/2^n ( n − n ) / 2 n corresponds to the probability that a Binomial random variable Bin ( n , 1 2 ) \operatorname{Bin}(n,\frac{1}{2}) Bin ( n , 2 1 ) equals n − n_- n − .
Algorithm 3: ENPOWERMC-β \beta β : exact computation of Banzhaf values for multiclass classification
Input: dataset D \mathcal{D} D , ensemble C = { C 1 , … , C n } \mathcal{C}=\{C_1,\ldots,C_n\} C = { C 1 , … , C n } , labels Y \mathcal{Y} Y .
β i ← 0 \beta_i \leftarrow0 β i ← 0 for i ∈ [ n ] i \in[n] i ∈ [ n ] ;
for ( x , y ) ∈ D (x,y)\in\mathcal{D} ( x , y ) ∈ D do
n 1 ← ∑ C ∈ C 1 [ C = y ] ; \quad n_1 \leftarrow\sum_{C\in\mathcal{C}}\mathbf{1}[C=y]; n 1 ← ∑ C ∈ C 1 [ C = y ] ;
D [ y ] ← 1 \quad D[y]\leftarrow1 D [ y ] ← 1 ; j ← 2 j\leftarrow2 j ← 2 ;
\quad for r ← 1 r\leftarrow1 r ← 1 to ℓ \ell ℓ do
\qquad if y r ≠ y y_r\ne y y r = y then
n j ← ∑ C ∈ C 1 [ C = y r ] \qquad\quad n_j\leftarrow\sum_{C\in\mathcal{C}}\mathbf{1}[C=y_r] n j ← ∑ C ∈ C 1 [ C = y r ] ; D [ y r ] ← j D[y_r]\leftarrow j D [ y r ] ← j ; j ← j + 1 j\leftarrow j+1 j ← j + 1 ;
\quad for j ← 1 j\leftarrow1 j ← 1 to ℓ \ell ℓ do β j ′ ← 0 \beta'_j\leftarrow0 β j ′ ← 0 ;
β 1 ′ ← 1 \quad\beta'_1\leftarrow1 β 1 ′ ← 1 ;
\quad for h ← 1 h\leftarrow1 h ← 1 to n 1 n_1 n 1 do
\qquad for j ← 2 j\leftarrow2 j ← 2 to ℓ \ell ℓ do A j ( h ) ← ∑ q = 0 h − 1 ( n j q ) A_j(h)\leftarrow\sum_{q=0}^{h-1}\binom{n_j}{q} A j ( h ) ← ∑ q = 0 h − 1 ( q n j ) , B j ( h ) ← ( n j h ) B_j(h)\leftarrow\binom{n_j}{h} B j ( h ) ← ( h n j ) ;
P h ( t ) ← ∏ j = 2 ℓ ( A j ( h ) + B j ( h ) t ) \qquad P_h(t)\leftarrow\prod_{j=2}^{\ell}(A_j(h)+B_j(h)t) P h ( t ) ← ∏ j = 2 ℓ ( A j ( h ) + B j ( h ) t ) ;
β 1 ′ ← β 1 ′ + ∑ k = 1 ℓ − 1 1 k + 1 [ ( n 1 − 1 h ) + ( n 1 − 1 h − 1 ) ] [ t k ] P h ( t ) ; \qquad\beta'_1\leftarrow\beta'_1+\sum_{k=1}^{\ell-1}\frac{1}{k+1}\left[\binom{n_1-1}{h}+\binom{n_1-1}{h-1}\right]\left[t^k\right]P_h(t); β 1 ′ ← β 1 ′ + ∑ k = 1 ℓ − 1 k + 1 1 [ ( h n 1 − 1 ) + ( h − 1 n 1 − 1 ) ] [ t k ] P h ( t ) ;
\quad for j ← 2 j\leftarrow2 j ← 2 to ℓ \ell ℓ do
β j ′ ← β j ′ − ∑ k = 0 ℓ − 2 1 k + 2 ( n 1 h ) [ ( n j − 1 h ) + 1 k + 1 ( n j − 1 h − 1 ) ] [ t k ] P h ( t ) A j ( h ) + B j ( h ) t ; \qquad\beta'_j\leftarrow\beta'_j-\sum_{k=0}^{\ell-2}\frac{1}{k+2}\binom{n_1}{h}\left[\binom{n_j-1}{h}+\frac{1}{k+1}\binom{n_j-1}{h-1}\right]\left[t^k\right]\frac{P_h(t)}{A_j(h)+B_j(h)t}; β j ′ ← β j ′ − ∑ k = 0 ℓ − 2 k + 2 1 ( h n 1 ) [ ( h n j − 1 ) + k + 1 1 ( h − 1 n j − 1 ) ] [ t k ] A j ( h ) + B j ( h ) t P h ( t ) ;
\quad for i ← 1 i\leftarrow1 i ← 1 to n n n do
y C ← C i ( x ) ; \qquad y_C\leftarrow C_i(x); y C ← C i ( x ) ;
j ← D [ y C ] ; \qquad j\leftarrow D[y_C]; j ← D [ y C ] ;
β i ← β i + β j ′ / 2 n − 1 ; \qquad\beta_i\leftarrow\beta_i+\beta'_j/2^{n-1}; β i ← β i + β j ′ / 2 n − 1 ;
return { β i / ∣ D ∣ } i ∈ [ n ] \{\beta_i/|\mathcal{D}|\}_{i\in[n]} { β i /∣ D ∣ } i ∈ [ n ] ;
Therefore, we employ such simple results to directly compute the ratio ( n n − ) / 2 n \binom{n}{n_-}/2^n ( n − n ) / 2 n , and we account for the missing term in β i \beta_i β i using a numerically stable implementation to evaluate the value 1 2 n \frac{1}{2^n} 2 n 1 .
Shapley power index (ENPOWERB _{\mathrm{B}} B ). The computation of Eq. (5) by its definition has several drawbacks. First it is not numerically stable, due to the large values of the terms involved in the summation, leading to numerical issues. Second, there are several repeated calculations, involving factorial and binomial terms. To address the above issues we evaluate ϕ i \phi_i ϕ i , i ∈ [ n ] i\in[n] i ∈ [ n ] through a recursive formula. That is, if we set w 0 = ( n + 2 n σ − 4 ) w_0=(n+2n_{\sigma}-4) w 0 = ( n + 2 n σ − 4 ) , T 0 = n τ n ( n − 1 ) ( n − 2 ) T_0=\frac{n_{\tau}}{n(n-1)(n-2)} T 0 = n ( n − 1 ) ( n − 2 ) n τ and
w j = w j − 1 − 4 and T h = 2 ( n σ − h ) ( n τ − h ) ( 2 h + 1 ) ( h + 1 ) ( n − 2 h − 1 ) ( n − 2 h − 2 ) T h − 1 , w_j=w_{j-1}-4 \quad\text{and}\quad T_h=\frac{2(n_{\sigma}-h)(n_{\tau}-h)(2h+1)}{(h+1)(n-2h-1)(n-2h-2)}T_{h-1}, w j = w j − 1 − 4 and T h = ( h + 1 ) ( n − 2 h − 1 ) ( n − 2 h − 2 ) 2 ( n σ − h ) ( n τ − h ) ( 2 h + 1 ) T h − 1 ,
for h ≥ 1 h\ge1 h ≥ 1 , then we can express ϕ i \phi_i ϕ i with the summation
ϕ i = ∑ h ≥ 0 T h w h . \phi_i=\sum_{h\ge0}T_hw_h. ϕ i = h ≥ 0 ∑ T h w h .
The above expression allows us to compute the Shapley values from Eq. (5) efficiently in linear time O ( n ) \mathcal{O}(n) O ( n ) . That is, we use a constant number of operations to evaluate each term T h w h T_hw_h T h w h . Moreover, the above summation is numerically stable since it avoids evaluating factorials and binomials.
Banzhaf and Shapley power indices for the multiclass case (ENPOWERM C _{\mathrm{MC}} MC ). We note that a naive implementation of Algorithms 3 and 4 would incur in numerical issues (such as integer overflows) due to the computation of large binomial and factorials. To fix such issue our C++ implementation represents the coefficients of the dynamic programming matrices as exact integers. Specifically, for each vote profile we use the smallest fixed-width unsigned integer to represent the numbers used in the evaluations of Theorem 4.6 and Theorem 4.8 , ranging the length from 128 up to 1024 bits, which supports ensembles with n ≤ 1023 n\le1023 n ≤ 1023 . We then only evaluate in floating point the final weighted sum corresponding to the power indices. Note that long integers increase the cost of arithmetical operations such as multiplications, which is however necessary to enable the practical usability of our methods, i.e., retaining the accuracy of the exact computation of our methods. As a consequence, the above discussion explains the high runtime of ENPOWER-ϕ \phi ϕ on the CT dataset and the AdaBoost ensemble from Table 5 .
Algorithm 4: ENPOWERMC-$\phi$: exact computation of Shapley values for multiclass classification
Input: dataset $\mathcal{D}$, ensemble $\mathcal{C} = \{C_1,\ldots,C_n\}$, labels $\mathcal{Y}$.
1 $\phi_i \leftarrow 0$ for $i \in [n]$
2 $J_{\mathrm{unique}} \leftarrow$ empty dictionary
3 for $(x,y) \in \mathcal{D}$ do
4 $n_1 \leftarrow \sum_{C\in\mathcal{C}} \mathbf{1}[C=y]$
5 $\mathcal{D}[y] \leftarrow 1$; $j \leftarrow 2$
6 $\boldsymbol{p} \leftarrow (n_1,0,\ldots,0) \in \mathbb{R}^{\ell}$
7 for $r \leftarrow 1$ to $\ell$ do
8 if $y_r \ne y$ then
9 $n_j \leftarrow \sum_{C\in\mathcal{C}}\mathbf{1}[C=y_r]$; $p_j \leftarrow n_j$; $\mathcal{D}[y_r] \leftarrow j$; $j \leftarrow j+1$
10 if $\boldsymbol{p} \in J_{\mathrm{unique}}$ then
11 $(\phi'_1,\ldots,\phi'_{\ell}) \leftarrow J_{\mathrm{unique}}[\boldsymbol{p}]$
12 else
13 for $j \leftarrow 1$ to $\ell$ do $\phi'_j \leftarrow 0$
14 $\phi'_1 \leftarrow 1/n$
15 for $h \leftarrow 1$ to $n_1$ do
16 $P_h \leftarrow \operatorname{ComputeCoeffsDP}(n_j\ \text{for }j\in[2,\ell],h)$
17 for $k \leftarrow 1$ to $\ell-1$ do
18 for $m \leftarrow kh$ to $n-n_1$ do
19 $\phi'_1 \leftarrow \phi'_1+f_1(k,h,m)P_h[k,m]$
20 for $n_j \in J_{\mathrm{unique}}.\operatorname{keys}()$ do
21 $P_h \leftarrow \operatorname{RemoveClass}(P_h,n_j,h)$
22 $\phi_{\mathrm{curr}} \leftarrow 0$
23 for $k \leftarrow 0$ to $\ell-2$ do
24 for $m \leftarrow kh$ to $n-(n_1+n_j)$ do
25 $\phi_{\mathrm{curr}} \leftarrow \phi_{\mathrm{curr}}+f_j(k,h,m)P_h[k,m]$
26 $P_h \leftarrow \operatorname{AddClass}(P_h,n_j,h,\ell-2,\sum_{j'\ge 2}n_{j'}-n_j)$
27 $J_{\mathrm{unique}}[\boldsymbol{p}] \leftarrow (\phi'_1,\ldots,\phi'_{\ell})$
28 for $i \leftarrow 1$ to $n$ do
29 $y_C \leftarrow C_i(x)$
30 $j \leftarrow \mathcal{D}[y_C]$
31 $\phi_i \leftarrow \phi_i+\phi'_j$
32 return $\{\phi_i/|\mathcal{D}|\}_{i\in[n]}$
Algorithm 5: ComputeCoeffsDP($n_j$ for $j \in [2,\ell],h$)
Input: Number of classifiers $n_j$ for each incorrect class $j \in [2,\ell]$, threshold $h$
1 $n' \leftarrow 0$; $P_h \leftarrow 0 \in \mathbb{R}^{\ell\times(\sum_{j\ge 2}n_j+1)}$;
2 $P_h[0,0] \leftarrow 1$;
3 for $j \leftarrow 2$ to $\ell$ do
4 $P_h \leftarrow \operatorname{AddClass}(P_h,n_j,h,j-2,n')$;
5 $n' \leftarrow n'+n_j$;
6 return $P_h$;
Reproducibility
Setup
Environment. The code was executed on a machine with four Intel Xeon Gold 6252N CPU @ 2.30/3.60GHz and 3TB of RAM memory. All experiments are executed in the same container based on Debian Linux, obtained through Apptainer,7 and that we provide with our source code.8 Our container builds the necessary environment specifying: the C++ compiler and the Python versions and
Algorithm 6: AddClass($P_h$, $n_j$, $h$, $u$, $m'$)
Input: Matrix $P_h$, counts $n_j$, threshold $h$, max current label ties $u$, max incorrect votes $m'$
1 $q_{\max} \leftarrow \min(n_j,h-1)$
2 for $k \leftarrow u$ downto 0 do
3 for $m \leftarrow m'$ downto 0 do
4 if $P_h[k,m] > 0$ then
5 if $n_j \ge h$ then
6 $P_h[k+1,m+h] \leftarrow P_h[k+1,m+h] + P_h[k,m]\cdot \binom{n_j}{h}$;
7 for $q \leftarrow q_{\max}$ downto 1 do
8 $P_h[k,m+q] \leftarrow P_h[k,m+q] + P_h[k,m]\cdot \binom{n_j}{q}$;
9 return $P_h$;
Algorithm 7: RemoveClass($P_h$, $n_j$, $h$)
Input: Matrix $P_h$, classifier count $n_j$, threshold $h$
1 $q_{\max} \leftarrow \min(n_j,h-1)$
2 $n' \leftarrow \sum_{i=2}^{\ell} n_i$
3 for $k \leftarrow 0$ to $\ell-2$ do
4 for $m \leftarrow 0$ to $n'$ do
5 if $n_j \ge h$ and $k \ge 1$ and $m \ge h$ then
6 $P_h[k,m] \leftarrow P_h[k,m] - P_h[k-1,m-h]\cdot \binom{n_j}{h}$;
7 for $q \leftarrow 1$ to $q_{\max}$ do
8 if $m \ge q$ then
9 $P_h[k,m] \leftarrow P_h[k,m] - P_h[k,m-q]\cdot \binom{n_j}{q}$;
10 return $P_h$;
packages. Each run is sequential: it uses a single thread on a dedicated CPU core. All our reported time measurements do not include the training of the ensembles or the evaluation of the predictions of base models.
All our methods use either Python or C++: (i) we use C++17, compiled with g++ and optimization flags for all algorithms of ENPOWER, i.e., ENPOWER-β \beta β and ENPOWER-ϕ \phi ϕ for the binary and multiclass settings, and ENPOWERMC-ϕ \phi ϕ ++; and our baselines WMG and ISCG, and the sampling baseline MC. (ii) we use Python 3.10 for the baselines Tr-MLE and Tr-PS, i.e., using the code of Rozemberczki and Sarkar [36 ] .9 We also use Python to train all ensembles through Scikit-learn, and computing the predictions of CLIP by using PyTorch.
Algorithm 8: Monte-Carlo estimation of $\psi \in \{\phi,\beta\}$
Input: Dataset $\mathcal{D}$, ensemble $\mathcal{C}$, sample size $s$.
1 $\hat{\psi}_i \leftarrow 0$, $i \in [n]$;
2 for $i \leftarrow 1$ to $n$ do
3 for $k \leftarrow 1$ to $s$ do
4 $S \leftarrow \varnothing$;
5 if $\psi = \beta$ then
6 $S \leftarrow \{j \ne i : \mathrm{FairCoin}_j = \mathrm{H}\}$.
7 else
8 $\sigma \leftarrow \mathrm{RandomPermutation}(n)$;
9 $S \leftarrow \{j : \sigma_j < \sigma_i\}$;
10 for $(x,y) \in \mathcal{D}$ do $\hat{\psi}_i \leftarrow \hat{\psi}_i + (v(S+i)-v(S))$;
11 return $\{\hat{\psi}_i/(s|\mathcal{D}|)\}_{i\in[n]}$;
CLIP. We use CLIP’s version ViT-B/32.10
Ensembles training. As mentioned in § 5 for our experiments comparing with sota (state-of-the-art) approaches we use the 75% of data points of each dataset to train three different ensembles. More in detail we use the default classifiers available from Scikit-learn. In particular,
For both RF and AB we do not set any custom parameter other than the number of classifiers required;
For HET we train each classifier with slightly different parameters to enforce heterogeneity.
All the details of the parameter settings are easily accessed in our code repository https://github.com/iliesarpe/enpower .
Datasets
We describe the datasets used in our experiments of § 5 . The scripts to replicate the processing of our datasets is in our code repository https://github.com/iliesarpe/enpower .
Binary and multiclass classification. The datasets used in our experiments for the binary and multiclass classification experiments of § 5 are reported in Table 1 . We additionally report the distribution of the classes of each dataset in Table 1 . All datasets are publicly available.11 Each dataset was processed with a standard pipeline as follows,
Table 1 : Datasets used for binary and multiclass classification settings in § 5 . Classes (ℓ \ell ℓ ), denotes the original number of labels, which are also retained for the multiclass experiments. The last two columns display the number of points in D v a l ∪ D t e s t D_{\mathrm{val}} \cup D_{\mathrm{test}} D val ∪ D test with label y = 1 y = 1 y = 1 and y = 0 y = 0 y = 0 after binarization.
Table 1.
for the binary classification scenario we remapped multiple classes by retaining the most frequent class as positive (y = 1 y = 1 y = 1 ) and all other classes collectively as negative (y = 0 y = 0 y = 0 );
numerical features were standardized to zero mean and unit variance;
missing values were set to the median for the respective feature;
categorical features were mapped to integers;
we split each dataset with a 75/15/10 split. The 75% split of data points is used for training. The 15% split constitutes D v a l D_{\mathrm{val}} D val used to compute the rankings of the power indices according to the various methods. Finally, the remaining 10% split is used for testing, constituting D t e s t D_{\mathrm{test}} D test . We first draw the 75% training split at random, and then split the remaining 25% of the points at random into D v a l D_{\mathrm{val}} D val (60% of the remaining) and D t e s t D_{\mathrm{test}} D test (40% of remaining points).
LLM prompt ensembling. For our experiments of § 5.4 we rely on publicly available datasets for image classification. Their statistics are reported in Table 2 , and some sample images are show in Figure 5 . We further report the statistics for class distribution in Table 3 . We observe that our datasets are heterogeneous: CIFAR is perfectly balanced (imbalance ratio (IR) 1.0), PETS is nearly balanced (IR, 1.14), and IMAGENET-A is highly imbalanced (IR, 33.3), showing that our methods are not affected by class distribution as captured by our theoretical results. Each dataset was split retaining 50% of its points for D v a l D_{\mathrm{val}} D val and the rest for D t e s t D_{\mathrm{test}} D test .
Table 3: Class-imbalance statistics for the multiclass datasets of § 5.4 (computed on D v a l ∪ D t e s t D_{\mathrm{val}} \cup D_{\mathrm{test}} D val ∪ D test , hence equal on every split). ℓ \ell ℓ is the number of classes. “min/max” are the smallest/largest number of points (images) with the same class; I R = max / min IR = \max/ \min I R = max / min is the imbalance ratio; C V CV C V is the coefficient of variation computed over the cardinality of all classes; and H n o r m ∈ ( 0 , 1 ] H_{\mathrm{norm}} \in(0,1] H norm ∈ ( 0 , 1 ] is the normalized Shannon entropy of the class distribution (1 corresponds to a uniform distribution).
Table 3.
Figure 5. Sample images from the three datasets considered in § 5.4 . CIFAR consists of tiny, low resolution (32×32 pixel) images. PETS consists of high quality images of different pets with fine-grained classes, and IMAGENET-A is a notorious challenging dataset for image classification.
Baselines
Baselines for binary classification. Here we provide more details for the baselines of our experiments.
ISCG [47 ] computes the Shapley values of each base classifier through a game on a graph capturing pairwise relationship between base classifier (see § 2 ) and their diversity across predictions. Note that the game of ISCG does not capture how the actual ensemble aggregates their votes. The game is an induced subgraph game [10 ] on the complete graph where each vertex corresponds to a base classifier, with the addition of self-loops. An edge { i , j } \{i,j\} { i , j } has weight w i j w_{ij} w ij , and the self-loop at vertex i i i has weight w i i w_{ii} w ii . The value v v v of a coalition S S S corresponds to the sum of the weights of the edges and self-loops with both endpoints in S S S . The Shapley value of C i C_i C i corresponds to w i i + 1 2 ∑ j ≠ i w i j w_{ii} + \frac{1}{2}\sum_{j\ne i} w_{ij} w ii + 2 1 ∑ j = i w ij [10 ] . The weights depend only on which classifiers are correct. For a point drawn uniformly at random from D v a l D_{\mathrm{val}} D val , let Z i = 1 Z_i = 1 Z i = 1 if C i C_i C i classifies the point correctly, and Z i = 0 Z_i = 0 Z i = 0 otherwise. Following Ykhlef and Bouchaffra [47 ] , Eq. (5) to (7) , we set
w i i = Pr [ Z i = 1 ] , w i j = 1 2 ( Pr [ Z i = 1 ∣ Z j = 0 ] + Pr [ Z j = 1 ∣ Z i = 0 ] ) for i ≠ j . w_{ii} = \Pr[Z_i = 1], \qquad w_{ij} = \frac{1}{2}\left(\Pr[Z_i = 1 \mid Z_j = 0] + \Pr[Z_j = 1 \mid Z_i = 0]\right) \quad\text{for } i \ne j. w ii = Pr [ Z i = 1 ] , w ij = 2 1 ( Pr [ Z i = 1 ∣ Z j = 0 ] + Pr [ Z j = 1 ∣ Z i = 0 ] ) for i = j .
Hence w i i w_{ii} w ii corresponds to the accuracy of C i C_i C i on D v a l D_{\mathrm{val}} D val . While the term Pr [ Z i = 1 ∣ Z j = 0 ] \Pr[Z_i = 1 \mid Z_j = 0] Pr [ Z i = 1 ∣ Z j = 0 ] corresponds to the fraction of the points misclassified by C j C_j C j that C i C_i C i classifies correctly. When C j C_j C j performs no classifications, we set the fraction to 0. We compute the weights on D v a l D_{\mathrm{val}} D val , as for all other methods.
Tr-MLE and Tr-PS implement the algorithms of Owen [34 ] and Maleki et al. [27 ] , respectively. Both methods compute the Shapley values under the definition of game introduced in Rozemberczki and Sarkar [36 ] , and both methods are approximate. In our setting, for each point z = ( x , y ) z = (x,y) z = ( x , y ) in
Additional experimental results
D v a l \mathcal{D}_{\mathrm{val}} D val Troupe considers a simple weighted majority game, in which base classifier C i C_i C i has weight w i ( x ) = 1 n 1 [ C i ( x ) = y ] w_i(x) = \frac{1}{n}\mathbb{1}[C_i(x) = y] w i ( x ) = n 1 1 [ C i ( x ) = y ] . And for a fixed coalition S ⊆ C S \subseteq\mathcal{C} S ⊆ C it holds
v T r ( z , S ) = 1 [ ∑ i ∈ S w i ( x ) > q ] , q = 1 2 . v_{\mathrm{Tr}}(z, S) = \mathbb{1}\left[\sum_{i \in S} w_i(x) > q\right], \qquad q = \frac{1}{2}. v Tr ( z , S ) = 1 [ i ∈ S ∑ w i ( x ) > q ] , q = 2 1 .
That is, a coalition S S S attains a value of 1 for the game over z z z it contains at least n / 2 n/2 n /2 base classifiers that are correct on x x x . Note that the quota is relative to the size n n n of the ensemble, not to ∣ S ∣ |S| ∣ S ∣ , and must be fixed in advance. The power-index that we report for C i C_i C i , i ∈ [ n ] i \in[n] i ∈ [ n ] corresponds to average of its Shapley value over the games of the points in D v a l \mathcal{D}_{\mathrm{val}} D val . We use the code of Rozemberczki and Sarkar [36 ] with the above weights and quota. Tr-PS samples 1 000 permutations, and we execute it five times. While, Tr-MLE is deterministic. We note that on a point with at most n / 2 n/2 n /2 correct base classifiers the grand coalition has value 0, and every Shapley value of that game is 0. The code of the authors does not return 0 on such a point, and we use their code unaltered.12
WMG implements the algorithms of [42 ] for computing the Banzhaf and Shapley values under WMGs, for which we set the weight of a classifier on a point to 1 if it predicts the label of the point correctly and to 0 otherwise, and the quota to q = ⌊ n / 2 ⌋ + 1 q = \lfloor n/2 \rfloor+ 1 q = ⌊ n /2 ⌋ + 1 . Each point of D v a l \mathcal{D}_{\mathrm{val}} D val thus defines one WMG. For each model C i C_i C i , its power index Banzhaf (resp. Shapley) value that we report under WMG is obtained as the average over the points of D v a l \mathcal{D}_{\mathrm{val}} D val . Note that in a WMG for a fixed point, the power index depends only on the number of correct base classifiers, i.e., n + n_+ n + . We therefore run the dynamic program of Uno [42 ] once per distinct value of n + n_+ n + , and reuse its output for all points with the same values of n + n_+ n + .
We have also implemented two simple Monte-Carlo algorithms for our game, denoted as MC-ϕ \phi ϕ and MC-β \beta β . Given that these algorithms require a high runtime to converge, and have poor estimation quality (see Table 4 ) we did not consider such baselines in our discussion. On every configuration, we draw n 2 n^2 n 2 samples for each base classifier. We remark that obtaining efficient sampling algorithms for our formulation remains an interesting and challenging open direction, especially for the multiclass case.
Table 4. Approximation error of the MC baseline. For each dataset and power index we report the maximum absolute (ε a b s \varepsilon_{\mathrm{abs}} ε abs ) and the maximum relative approximation error (ε r e l \varepsilon_{\mathrm{rel}} ε rel ), over all models from C \mathcal{C} C . We further report the Kendall’s (τ \tau τ ) and Spearman (ρ \rho ρ ) ranking coefficients, with the exact scores computed by ENPOWER. The results are the average and standard deviation over five random splits.
Baselines for multiclass classification. All our baselines based on WMGs do not directly extend to the multiclass setting (see Sec. A). Possible ways to adapt such baselines for a fixed point z = ( x , y ) z = (x, y) z = ( x , y ) are to average the power indices obtained over (i) one binary game for each pair of labels, i.e., O ( ℓ 2 ) \mathcal{O}(\ell^2) O ( ℓ 2 ) games for each point; or (ii) one binary game between y y y and each of the ℓ − 1 \ell- 1 ℓ − 1 incorrect labels, i.e., O ( ℓ ) \mathcal{O}(\ell) O ( ℓ ) games for each point. The only method admitting a multiclass formulation, by Ykhlef and Bouchaffra [47 ] , has no public implementation, and it already correlates poorly with our indices in the binary case in our implementation (specifically on RF and HET, see § 5.2 ). We therefore consider Tr-MLE and Tr-PS as our multiclass baselines, with a simpler reduction than (i) and (ii): a single binary game for each point, between y y y and all other incorrect labels. The game of Tr Troupe is a simple weighted game where a coalition (i.e., a sub-ensemble) either wins or loses. Hence, such formulation cannot capture which of the ℓ − 1 \ell- 1 ℓ − 1 incorrect classes an incorrect model votes for. For each point z = ( x , y ) z = (x, y) z = ( x , y ) of D v a l \mathcal{D}_{\mathrm{val}} D val we evaluate Troupe as follows: we retain only the correctness of the predictions of model C i C_i C i on the data point x x x , i.e., 1 [ C i ( x ) = y ] \mathbb{1}[C_i(x) = y] 1 [ C i ( x ) = y ] , and we assign to each base classifier a weight w i ( x ) = 1 n 1 [ C i ( x ) = y ] w_i(x) = \frac{1}{n}\mathbb{1}[C_i(x) = y] w i ( x ) = n 1 1 [ C i ( x ) = y ] , as for the binary case. That is, a coalition S S S wins, i.e., v T r ( z , S ) = 1 v_{\mathrm{Tr}}(z, S) = 1 v Tr ( z , S ) = 1 , if it contains more than n / 2 n/2 n /2 correct base classifiers (quota q = 1 2 q = \frac{1}{2} q = 2 1 ). We then execute Tr-MLE and Tr-PS on such game with the parameters of the binary case, and average the values of each C i C_i C i , i ∈ [ n ] i \in[n] i ∈ [ n ] over the points of D v a l \mathcal{D}_{\mathrm{val}} D val . The above game v T r v_{\mathrm{Tr}} v Tr differs substantially from v M C v_{\mathrm{MC}} v MC : (i) each incorrect base classifier has weight 0, i.e., models voting for different incorrect labels cannot be distinguished; (ii) v T r v_{\mathrm{Tr}} v Tr requires more than n / 2 n/2 n /2 correct classifiers to evaluate to 1, while v M C v_{\mathrm{MC}} v MC does not require a fixed quota; and (iii) v T r v_{\mathrm{Tr}} v Tr does not account for ties (see Eq. (3) ), as it requires a strict majority. For example, let n = 22 n = 22 n = 22 , and consider a point z z z with 8 correct votes and 2 votes on each of the remaining 7 incorrect labels. According to the plurality voting rule, the ensemble classifies x x x correctly, thus v M C ( z , C ) = 1 v_{\mathrm{MC}}(z, \mathcal{C}) = 1 v MC ( z , C ) = 1 , while v T r ( z , C ) = 0 v_{\mathrm{Tr}}(z, \mathcal{C}) = 0 v Tr ( z , C ) = 0 , and every Shapley value of v T r v_{\mathrm{Tr}} v Tr for the game over z z z is 0, since v T r ( z , S ) = 0 v_{\mathrm{Tr}}(z, S) = 0 v Tr ( z , S ) = 0 for every S ⊆ C S \subseteq\mathcal{C} S ⊆ C . Data points with less than n / 2 n/2 n /2 base correct classifiers are common in our experiments, e.g., on IMAGENET-A (see Table 11 ).
Additional experimental results
Monte-Carlo approximation
We show the estimation quality achieved by our simple sampling baseline from Algorithm 8 in Table 4 . We computed, for each model the absolute error ε a b s = ∣ ψ i − ψ ^ i ∣ \varepsilon_{\mathrm{abs}} = |\psi_i - \hat{\psi}_i| ε abs = ∣ ψ i − ψ ^ i ∣ and the relative error ε r e l = ∣ ψ i − ψ ^ i ∣ / ∣ ψ i ∣ \varepsilon_{\mathrm{rel}} = |\psi_i - \hat{\psi}_i|/|\psi_i| ε rel = ∣ ψ i − ψ ^ i ∣/∣ ψ i ∣ , where ψ ^ i \hat{\psi}_i ψ ^ i corresponds to the estimated value approximated by MC-ψ \psi ψ for ψ ∈ { β , ϕ } \psi\in\{\beta,\phi\} ψ ∈ { β , ϕ } . Finally we also report the Kendall’s τ \tau τ and Spearman’s correlation metrics. We recall that the results refer to the binary classification in § 4.1 , where the sample size is s = n 2 s = n^2 s = n 2 ; note that the number of possible samples is exponential in n n n .
We observe from Table 4 , that overall the performances of the sampling approach are quite remarkable in recovering most of the ranking metrics. However, we also note that on some configurations (e.g., BM with RF and HET, and CT with RF) the ranking metrics with the exact Shapley values are below 0.3. We also observe a non-negligible relative error in some configurations (e.g., BTSC with HET), likely due to the small values of the values of ϕ i \phi_i ϕ i and β i \beta_i β i for i ∈ [ n ] i \in[n] i ∈ [ n ] . This connects to a well known phenomena for sampling algorithms, which require a very high sample size to provide high quality approximations of extremely small values [32 ] .
We remark that we leave as an open direction designing efficient sampling algorithms, especially for the multiclass case, e.g., by reusing samples across different models.
Runtime of ENPOWERM C _{\mathrm{MC}} MC
Table 5 reports the runtime of our methods on the two datasets of Table 1 with ℓ ≥ 3 \ell\ge3 ℓ ≥ 3 labels, i.e., datasets C9 and CT. ENPOWER-β \beta β requires at most 2 seconds in all configurations, including CT, our largest dataset. ENPOWER-ϕ \phi ϕ requires at most 8 seconds on C9, and at most 3 seconds on CT with RF and HET. The only exception corresponds to CT with AB, our largest ensemble (n = 150 n = 150 n = 150 ), where ENPOWER-ϕ \phi ϕ requires approximately 4 minutes, due to the O ( n 3 ) O(n^3) O ( n 3 ) term in its complexity and to the exact integer arithmetic (see Sec. E); ENPOWERM C _{\mathrm{MC}} MC -ϕ \phi ϕ ++ reduces this runtime to about 77 seconds.
Accuracy of the base classifiers
Table 6 reports the mean and the standard deviation of the accuracy of the base classifiers on D v a l \mathcal{D}_{\mathrm{val}} D val , for each combination of dataset and ensemble.
Table 6. Accuracy on D v a l \mathcal{D}_{\mathrm{val}} D val of the base classifiers of each ensemble, binary classification. Each entry is the mean ± \pm ± the standard deviation over the base classifiers of the ensemble, both averaged over five random splits.
CLIP prompt ensembling
Ensemble sub-selection
We present additional experimental results for the sub-ensemble selection task in Figure 7 . To complement our discussion, we observe that a selection of the top-k k k models with the rankings provided by ENPOWER yields a sub-ensemble consistently ranking among the ones with best generalization for the accuracy and F 1 F_1 F 1 -score metrics. There are, however few exceptions. On CT with AB, ACC attains higher accuracy and F 1 F_1 F 1 -score for intermediate values of k k k . On CR with HET, WMG-φ \varphi φ and WMG-β \beta β attain higher metrics for small values of k k k . On both configurations the base classifiers have similar accuracy (see Table 6 ), thus the rankings of the methods depend on how each formulation weights the classifiers on points with tied votes. The indices of ENPOWER capture the contribution of each base classifier to the full ensemble with random tie-breaking, and such contributions may differ on a sub-ensemble of size k < n k < n k < n . We believe that such behavior may also be related to other specific properties of the datasets and of the base models. Connecting properties of the input dataset with the use of the indices of ENPOWER for sub-ensemble selection is an interesting and important direction for our work. We note that when performing sub-ensemble selection, a different approach is to recompute the indices of the remaining players after selecting a model, i.e., see [9 ] .
Figure 7. Generalization metrics for sub-ensemble selection, missing results from § 5.3 .
CLIP prompt ensembling
The missing results of § 5.4 on the PETS dataset are reported in Figure 8 . Table 7 reports, for each ranking, the best accuracy and F 1 F_1 F 1 -score over k k k , the value of k k k attaining it, and the average of each metric over k ∈ [ n ] k \in[n] k ∈ [ n ] . The best k ∈ [ n ] k \in[n] k ∈ [ n ] corresponds to the value that maximizes the mean metric over the five D t e s t \mathcal{D}_{\mathrm{test}} D test (i.e., chosen independently for the accuracy and F 1 F_1 F 1 -score). Each entry of the table corresponds to the mean and its the standard deviation over the splits. As discussed in our main § 5.4 , a selection according to the power indices yields metrics comparable to ACC and higher than Tr-MLE and Tr-PS.
Figure 8. Accuracy and F 1 F_1 F 1 -score test metrics for the prompt ensembling of CLIP on D t e s t \mathcal{D}_{\mathrm{test}} D test (see § 5.4 ), as a function of k k k . Missing results from § 5.4 .
Table 8 reports the runtime of all methods on D v a l \mathcal{D}_{\mathrm{val}} D val . ENPOWER-β \beta β terminates in less than 0.02 seconds and ENPOWER-ϕ \phi ϕ in less than one second on all three datasets, while Tr-PS requires up to 1.3 seconds.
Table 8. Runtime (seconds) of the ranking methods on D v a l \mathcal{D}_{\mathrm{val}} D val for the prompt ensembling of CLIP, average ± \pm ± standard deviation over five random splits.
In addition we also show the variation in the rankings produced by accuracy and our methods on a fixed split in Table 9 to Table 11 . An analysis of such tables provides some interesting results about the interaction between different prompts. We note that, for example, on dataset CIFAR the prompt “A cropped photo of a {}.”, which is highly ranked by accuracy, has a poor ranking according to power indices. That is, such prompt is affecting the overall performances of the ensemble, as it can be seen by its negative Banzhaf value.
Other interesting trends can be observed over Table 9 to Table 11 for example
the rankings of prompt “A macro shot of a {}” in Table 10 . That is such prompt that has poor accuracy ranking but high synergy with the overall ensemble as captured by power indices.
the rankings of prompt “A photo of a {}, with a watermark.” on the IMAGENET-A dataset in Table 11 . That prompt is ranked high by accuracy, but is has significantly smaller ranks according to power indices.
Table 10. Prompt ensemble evaluation for LLM zero-shot multiclass image classification (PETS). Each prompt corresponds to a different model of C C C . All values and rankings are computed on the validation split D v a l \mathcal{D}_{\mathrm{val}} D val . Columns Δ β \Delta_\beta Δ β and Δ ϕ \Delta_\phi Δ ϕ display the difference in the validation rankings induced by the power indices β ( G M C ) \beta(G_{\mathrm{MC}}) β ( G MC ) and ϕ ( G M C ) \phi(G_{\mathrm{MC}}) ϕ ( G MC ) with respect to validation accuracy.
Overall our experiments for prompt ensembling show that ENPOWER for multiclass classification can provide a valuable addition for LLM prompt engineering, and to enhance the interpretability of LLM predictions under different prompts.
Synthetic experiments
Real data does not allow us to control the parameters that determine the runtime of ENPOWER. We therefore generate synthetic instances in which we vary the number ∣ U ∣ |U| ∣ U ∣ of unique vote profiles, the ensemble size n n n and the number of classes ℓ \ell ℓ . Recall that the runtime of our algorithms depends on ∣ U ∣ |U| ∣ U ∣ and not on ∣ P ∣ |\mathcal{P}| ∣ P ∣ . Finally, for the Shapley values we will also consider the runtime our refined algorithm E N P O W E R M C − ϕ + + \mathrm{ENPOWER}_{\mathrm{MC}-\phi++} ENPOWER MC − ϕ ++ from Sec. H.
Data generation. A vote profile is determined by two integers: the number n 1 n_1 n 1 of classifiers predicting the correct class, and the number r r r of incorrect labels receiving at least one vote. We allocate the n − n 1 n-n_1 n − n 1 incorrect votes evenly over r r r labels, i.e., ( n − n 1 ) m o d r (n-n_1) \bmod r ( n − n 1 ) mod r labels receive ⌈ ( n − n 1 ) / r ⌉ \lceil(n-n_1)/r \rceil ⌈( n − n 1 ) / r ⌉ votes and the other ones receive ⌊ ( n − n 1 ) / r ⌋ \lfloor(n-n_1)/r \rfloor ⌊( n − n 1 ) / r ⌋ votes. There are ℓ − 1 \ell-1 ℓ − 1 incorrect labels and n − n 1 n-n_1 n − n 1 incorrect votes, thus r ≤ r max ( n 1 ) ≔ min { ℓ − 1 , n − n 1 } r \le r_{\max}(n_1) \coloneqq\min\{\ell-1,n-n_1\} r ≤ r m a x ( n 1 ) : = min { ℓ − 1 , n − n 1 } . We consider 1 ≤ r ≤ r max ( n 1 ) 1 \le r \le r_{\max}(n_1) 1 ≤ r ≤ r m a x ( n 1 ) if n 1 < n n_1<n n 1 < n , and r = 0 r=0 r = 0 if n 1 = n n_1=n n 1 = n . Each distinct pair ( n 1 , r ) (n_1,r) ( n 1 , r ) yields a distinct profile. Given p ∈ ( 0 , 1 ) p \in(0,1) p ∈ ( 0 , 1 ) , we build an instance of ∣ U ∣ |U| ∣ U ∣ profiles as follows.
Let n 1 ∗ = ⌊ p n + 1 / 2 ⌋ n_1^*=\lfloor pn+1/2\rfloor n 1 ∗ = ⌊ p n + 1/2 ⌋ , i.e., p n pn p n rounded to the nearest integer.
Order the values n 1 ∈ { 0 , … , n } n_1 \in\{0,\ldots,n\} n 1 ∈ { 0 , … , n } as the sequence n 1 ∗ , n 1 ∗ − 1 , n 1 ∗ + 1 , n 1 ∗ − 2 , n 1 ∗ + 2 , … n_1^*, n_1^*-1, n_1^*+1, n_1^*-2, n_1^*+2,\ldots n 1 ∗ , n 1 ∗ − 1 , n 1 ∗ + 1 , n 1 ∗ − 2 , n 1 ∗ + 2 , … , i.e., in increasing order of ∣ n 1 − n 1 ∗ ∣ |n_1-n_1^*| ∣ n 1 − n 1 ∗ ∣ and, breaking ties in favor of the smallest value.
Build a list U U U of profiles by replacing each n 1 n_1 n 1 in this sequence with the profiles ( n 1 , r ) (n_1,r) ( n 1 , r ) in decreasing order of r r r , i.e., ( n 1 , r max ( n 1 ) ) , ( n 1 , r max ( n 1 ) − 1 ) , … , ( n 1 , 1 ) (n_1,r_{\max}(n_1)),(n_1,r_{\max}(n_1)-1),\ldots,(n_1,1) ( n 1 , r m a x ( n 1 )) , ( n 1 , r m a x ( n 1 ) − 1 ) , … , ( n 1 , 1 ) . The value n 1 = n n_1=n n 1 = n is replaced with the single profile ( n , 0 ) (n,0) ( n , 0 ) .
An instance consists of the first ∣ U ∣ |U| ∣ U ∣ profiles of such a list (i.e., of U U U ).
Hence the fraction of correct models n 1 / n n_1/n n 1 / n is close to the parameter p p p . Furthermore, for each n 1 n_1 n 1 the profiles that assign the incorrect votes over most of the incorrect labels are generated first. Note that when the incorrect votes are distributed evenly, many coalitions result in a tie, increasing the runtime of our algorithms for v M C ( ⋅ ) v_{\mathrm{MC}}(\cdot) v MC ( ⋅ ) . For the binary case it holds r max ( n 1 ) ≤ 1 r_{\max}(n_1)\le1 r m a x ( n 1 ) ≤ 1 , i.e., a profile is determined by n 1 n_1 n 1 uniquely. We vary p ∈ { 0.1 , 0.5 , 0.9 } p \in\{0.1,0.5,0.9\} p ∈ { 0.1 , 0.5 , 0.9 } , i.e., representing ensembles of base classifiers with low, medium and high accuracy. In the binary case we vary n ∈ { 100 , 300 , 1000 , 3000 , 10000 } n \in\{100,300,1000,3000,10000\} n ∈ { 100 , 300 , 1000 , 3000 , 10000 } and ∣ U ∣ ∈ { 10 , 20 , 40 , 80 , 160 } |U| \in\{10,20,40,80,160\} ∣ U ∣ ∈ { 10 , 20 , 40 , 80 , 160 } . In the multiclass case we vary n ∈ { 10 , 25 , 50 , 100 } n \in\{10,25,50,100\} n ∈ { 10 , 25 , 50 , 100 } , ℓ ∈ { 2 , 5 , 10 , 20 , 50 , 100 , 1000 } \ell\in\{2,5,10,20,50,100,1000\} ℓ ∈ { 2 , 5 , 10 , 20 , 50 , 100 , 1000 } and ∣ U ∣ ∈ { 10 , 10 2 , 10 3 } |U| \in\{10,10^2,10^3\} ∣ U ∣ ∈ { 10 , 1 0 2 , 1 0 3 } . We do not consider configurations with less than the fixed number ∣ U ∣ |U| ∣ U ∣ of profiles. We run each instance five times and divide its median runtime by ∣ U ∣ |U| ∣ U ∣ . For each ( p , n , ℓ ) (p,n,\ell) ( p , n , ℓ ) we report the median of these values over ∣ U ∣ |U| ∣ U ∣ , which we denote as the runtime per unique profile. The time complexity of our methods is linear in ∣ U ∣ |U| ∣ U ∣ , thus dividing by ∣ U ∣ |U| ∣ U ∣ isolates the influence of all other parameters on the runtime.
Results. Figure 9 reports the runtime per unique profile in log-log scale, where each row corresponds to a different value of p p p . In each panel the horizontal axis corresponds to the bound on the time complexity of the corresponding theorem (i.e., according to the setting and power index considered). That is
Figure 9. Runtime to process a unique vote profile on synthetic instances, where p = 0.1 p = 0.1 p = 0.1 (top), p = 0.5 p = 0.5 p = 0.5 (middle) and p = 0.9 p = 0.9 p = 0.9 (bottom). The y-axis reports the measured time to compute the power indices under a vote profile p ∈ U \boldsymbol{p} \in U p ∈ U with n n n players and ℓ \ell ℓ labels. See Sec. G.6 for a detailed description of each panel.
the left column reports ENPOWER-β \beta β and ENPOWER-ϕ \phi ϕ for the binary classification setting (ℓ = 2 \ell= 2 ℓ = 2 ) as a function of n n n (Theorem 4.3 );
the middle column reports ENPOWER-β \beta β in the multiclass classification setting as a function of n ℓ 2 n\ell^{2} n ℓ 2 (Theorem 4.7 ); and
the right column reports ENPOWER-ϕ \phi ϕ (circles, solid lines) and ENPOWERM C _{\mathrm{MC}} MC -ϕ \phi ϕ ++ (triangles, dashed lines) as a function of n 3 ℓ n^{3}\ell n 3 ℓ (Theorem 4.9 ).
Regarding the figures concerning the multiclass case each line connects the values of n n n for a fixed ℓ \ell ℓ , colored by the value of ℓ \ell ℓ . The dotted line in each panel corresponds to theoretical bound. In the binary classification setting, the runtime per unique profile of ENPOWER grows linearly with n n n (with a constant slightly smaller than 1), as predicted by Theorem 4.3 . In the multiclass setting for ENPOWER-β \beta β for a fixed value of ℓ \ell ℓ the runtime scales with n n n almost linearly as from the bound in Theorem 4.7 . The only setting where the runtime appears to be slightly larger than linear in n n n , is for p = 0.1 p = 0.1 p = 0.1 and a high value of ℓ \ell ℓ , where the number of incorrect labels approaches n n n . Interestingly, we observe that increasing ℓ \ell ℓ for a fixed n n n does not result in the O ( ℓ 2 ) O(\ell^{2}) O ( ℓ 2 ) of our bound, that is our bounds can be likely improved. Similarly, the theoretical runtime of ENPOWER-ϕ \phi ϕ and ENPOWERM C _{\mathrm{MC}} MC -ϕ \phi ϕ ++ for large values of n 3 ℓ n^{3}\ell n 3 ℓ is likely pessimistic given that in practice our methods are much more efficient. Finally, our method ENPOWERM C _{\mathrm{MC}} MC -ϕ \phi ϕ ++ is always more efficient than ENPOWER-ϕ \phi ϕ , as captured by our analysis (see Sec. H).
A refined multiclass Shapley value computation
Algorithm 4 can be implemented efficiently, improving over the time complexity bound of Theorem 4.9 . In this section we detail such a procedure. The key technical idea is that, for any fixed h ≥ 1 h \ge1 h ≥ 1 , the matrix P h P_h P h holding the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) (i.e., the matrix whose entry P h [ k , m ] P_h[k,m] P h [ k , m ] corresponds to the coefficient [ t k u m ] P h ( t , u ) [t^k u^m]P_h(t,u) [ t k u m ] P h ( t , u ) ), does not necessarily require to be of size of ℓ \ell ℓ rows and n − n 1 + 1 n-n_1+1 n − n 1 + 1 columns as in Algorithm 4. The definition of S ( k , h , m ) S(k,h,m) S ( k , h , m ) yields ∣ S ( k , h , m ) ∣ = 0 |S(k,h,m)|=0 ∣ S ( k , h , m ) ∣ = 0 for most of the triplets k , h , m k,h,m k , h , m , and by allocating a matrix that retains every non-zero coefficient of P h ( t , u ) P_h(t,u) P h ( t , u ) , we will improve the time complexity of the resulting algorithm. More precisely, fix h ≥ 1 h \ge1 h ≥ 1 and recall from Lemma C.5 that P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + B j ( h ; u ) t ) P_h(t,u)=\prod_{j=2}^{\ell}(A_j(h;u)+B_j(h;u)t) P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + B j ( h ; u ) t ) , where B j ( h ; u ) = ( n j h ) u h B_j(h;u)=\binom{n_j}{h}u^h B j ( h ; u ) = ( h n j ) u h . In each factor, the variable t t t multiplies the single monomial B j ( h ; u ) B_j(h;u) B j ( h ; u ) , and each such monomial contains exactly variable u h u^h u h . A monomial t k u m t^k u^m t k u m of P h ( t , u ) P_h(t,u) P h ( t , u ) therefore collects a factor u h u^h u h from each of its k k k factors that have term B j ( h ; u ) B_j(h;u) B j ( h ; u ) contributing to t k t^k t k , thus [ t k u m ] P h ( t , u ) = 0 [t^k u^m]P_h(t,u)=0 [ t k u m ] P h ( t , u ) = 0 when m < k h m<kh m < k h . In other words, each monomial t k u m t^k u^m t k u m of P h ( t , u ) P_h(t,u) P h ( t , u ) with a non-zero coefficient, must have m ≥ k h m \ge kh m ≥ k h . We use this insight to reduce the computation performed by ENPOWERMC-ϕ \phi ϕ , as it guarantees that the entries P h [ k , m ] P_h[k,m] P h [ k , m ] with m < k h m<kh m < k h are never visited by the algorithm. We formalize our argument in Lemma H.2 , and in Sec. H.2 we further exploit such insights to remove factor u h u^h u h from B j ( h ; u ) B_j(h;u) B j ( h ; u ) , recovering the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) by their degree in t t t .
We express our bounds as functions of the vote profile of a fixed data point from D \mathcal{D} D . Throughout we fix a test data point z = ( x , y ) ∈ D z=(x,y)\in\mathcal{D} z = ( x , y ) ∈ D and we let y = y 1 y=y_1 y = y 1 , as by our convention in § 4.2.2 . Furthermore, let N ≔ n − n 1 = ∣ C ′ ∣ N \coloneqq n-n_1=|\mathcal{C}'| N : = n − n 1 = ∣ C ′ ∣ be the number of incorrect classifiers from C \mathcal{C} C , and we let
n ( 1 ) ≥ n ( 2 ) ≥ ⋯ ≥ n ( ℓ − 1 ) n_{(1)} \ge n_{(2)} \ge\cdots\ge n_{(\ell-1)} n ( 1 ) ≥ n ( 2 ) ≥ ⋯ ≥ n ( ℓ − 1 )
denote the values { n j } j ∈ [ 2 , ℓ ] \{n_j\}_{j\in[2,\ell]} { n j } j ∈ [ 2 , ℓ ] sorted in non-increasing order.
Definition H.1. For h ∈ Z h\in\mathbb{Z} h ∈ Z we let
K ( h ) ≔ ∣ { j ∈ [ 2 , ℓ ] : n j ≥ h } ∣ , h ≥ 1 , and Φ ( h ) ≔ ∑ j = 2 ℓ min { n j , h } , h ≥ 0. K(h) \coloneqq\left|\{j\in[2,\ell]:n_j\ge h\}\right|,\ h\ge1,\qquad\text{and}\qquad\Phi(h)\coloneqq\sum_{j=2}^{\ell}\min\{n_j,h\},\ h\ge0. K ( h ) : = ∣ { j ∈ [ 2 , ℓ ] : n j ≥ h } ∣ , h ≥ 1 , and Φ ( h ) : = j = 2 ∑ ℓ min { n j , h } , h ≥ 0. In particular, Φ ( 0 ) = 0 \Phi(0)=0 Φ ( 0 ) = 0 . Furthermore, for each j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] and h ≥ 1 h\ge1 h ≥ 1 we let
K − j ( h ) ≔ K ( h ) − 1 [ n j ≥ h ] . K_{-j}(h)\coloneqq K(h)-\mathbb{1}[n_j\ge h]. K − j ( h ) : = K ( h ) − 1 [ n j ≥ h ] .
The value K ( h ) K(h) K ( h ) is the number of incorrect labels receiving at least h ≥ 1 h\ge1 h ≥ 1 votes, while Φ ( h ) \Phi(h) Φ ( h ) corresponds to the number of classifiers obtained by retaining, for each incorrect label, at most h h h of the classifiers predicting it. The value K − j ( h ) K_{-j}(h) K − j ( h ) is the number of incorrect labels other than y j y_j y j receiving at least h h h votes. We have K ( h ) ≤ ℓ − 1 K(h)\le\ell-1 K ( h ) ≤ ℓ − 1 and Φ ( h ) ≤ N \Phi(h)\le N Φ ( h ) ≤ N . For a fixed h ≥ 1 h\ge1 h ≥ 1 we compute the matrix P h P_h P h with K ( h ) + 1 K(h)+1 K ( h ) + 1 rows and Φ ( h ) + 1 \Phi(h)+1 Φ ( h ) + 1 columns, in place of the ℓ \ell ℓ rows and n − n 1 + 1 n-n_1+1 n − n 1 + 1 columns of Algorithm 4. We will show that all the remaining entries are zero, thus the refined algorithm retains the correctness of Algorithm 4. Such a matrix will still contain the entries P h [ k , m ] P_h[k,m] P h [ k , m ] with m < k h m<kh m < k h , which are zero as observed above, for simplicity of the analysis, simplifying our main result presented in Theorem H.7 .13
We let H ⋆ ≔ min { n 1 , n ( 1 ) } H^\star\coloneqq\min\{n_1,n_{(1)}\} H ⋆ : = min { n 1 , n ( 1 ) } denote the upper bound on the range of h h h . The following value will be fundamental for our analysis, recall that min { n j , n ( 1 ) } = n j \min\{n_j,n_{(1)}\}=n_j min { n j , n ( 1 ) } = n j for any j ≥ 2 j\ge2 j ≥ 2 , thus we let
N ⋆ ≔ Φ ( H ⋆ ) = ∑ j = 2 ℓ min { n j , min { n 1 , n ( 1 ) } } = ∑ j = 2 ℓ min { n j , n 1 } ≤ min { n − n 1 , ( ℓ − 1 ) n 1 } . N^\star\coloneqq\Phi(H^\star)=\sum_{j=2}^{\ell}\min\{n_j,\min\{n_1,n_{(1)}\}\}=\sum_{j=2}^{\ell}\min\{n_j,n_1\}\le\min\{n-n_1,(\ell-1)n_1\}. N ⋆ : = Φ ( H ⋆ ) = j = 2 ∑ ℓ min { n j , min { n 1 , n ( 1 ) }} = j = 2 ∑ ℓ min { n j , n 1 } ≤ min { n − n 1 , ( ℓ − 1 ) n 1 } .
We now show how to implement Algorithm 4 refining the time complexity of Theorem 4.9 to
O ( ∣ U ∣ ( ( N ⋆ ) 3 + ℓ ( N ⋆ ) 2 ) + ∣ D ∣ n ) , \mathcal{O}\left(|\mathcal{U}|((N^\star)^3+\ell(N^\star)^2)+|\mathcal{D}|n\right), O ( ∣ U ∣ (( N ⋆ ) 3 + ℓ ( N ⋆ ) 2 ) + ∣ D ∣ n ) ,
a result that we prove in Theorem H.7 below. The refined bound is never worse than the bound of Theorem 4.9 , for every vote profile.
Consider the following two settings: (a) when all but a constant number of classifiers are correct, i.e., n − n 1 = O ( 1 ) n-n_{1}=O(1) n − n 1 = O ( 1 ) , we have N ⋆ ≤ N = O ( 1 ) N^{\star}\leq N=O(1) N ⋆ ≤ N = O ( 1 ) , thus the time complexity reduces to O ( ∣ U ∣ ℓ + ∣ D ∣ n ) O(|U|\ell+|D|n) O ( ∣ U ∣ ℓ + ∣ D ∣ n ) ; (b) when the correct label receives a constant number of votes, i.e., n 1 = O ( 1 ) n_{1}=O(1) n 1 = O ( 1 ) , we have N ⋆ = O ( min { n , ℓ } ) N^{\star}=O(\min\{n,\ell\}) N ⋆ = O ( min { n , ℓ }) , thus the time complexity reduces to O ( ∣ U ∣ ℓ min { n , ℓ } 2 + ∣ D ∣ n ) O(|U|\ell\min\{n,\ell\}^{2}+|D|n) O ( ∣ U ∣ ℓ min { n , ℓ } 2 + ∣ D ∣ n ) , as min { n , ℓ } 3 ≤ ℓ min { n , ℓ } 2 \min\{n,\ell\}^{3}\leq\ell\min\{n,\ell\}^{2} min { n , ℓ } 3 ≤ ℓ min { n , ℓ } 2 , that is we do not incur a factor O ( n 3 ℓ ) O(n^{3}\ell) O ( n 3 ℓ ) as in Theorem 4.9 .
We now introduce the modifications to Algorithm 4, restricting the size of P h P_h P h and enabling our improved time complexity.
enpowerMC- ++: an improved algorithm
We now list the modifications to Algorithm 4 to obtain our improved algorithm named ENPOWERMC-ϕ \phi ϕ ++.
First we need some definitions, for k ∈ { 1 , … , ℓ − 1 } k\in\{1,\ldots,\ell-1\} k ∈ { 1 , … , ℓ − 1 } and h ≥ 1 h\geq1 h ≥ 1 , we let
m ‾ ( k , h ) = min { N , k + Φ ( h − 1 ) } . \overline{m}(k,h)=\min\{N,k+\Phi(h-1)\}. m ( k , h ) = min { N , k + Φ ( h − 1 )} .
Similarly, for each j ∈ { 2 , … , ℓ } j\in\{2,\ldots,\ell\} j ∈ { 2 , … , ℓ } , k ∈ { 0 , … , ℓ − 2 } k\in\{0,\ldots,\ell-2\} k ∈ { 0 , … , ℓ − 2 } and h ≥ 1 h\geq1 h ≥ 1 we let
m ‾ − j ( k , h ) : = min { N − n j , k + Φ ( h − 1 ) − min { n j , h − 1 } } , \overline{m}_{-j}(k,h):=\min\{N-n_j,k+\Phi(h-1)-\min\{n_j,h-1\}\}, m − j ( k , h ) := min { N − n j , k + Φ ( h − 1 ) − min { n j , h − 1 }} ,
where N − n j = n − ( n 1 + n j ) N-n_j=n-(n_1+n_j) N − n j = n − ( n 1 + n j ) is the number of classifiers predicting a label in Y − { y 1 , y j } \mathcal{Y}-\{y_1,y_j\} Y − { y 1 , y j } .
We are now ready to introduce ENPOWERMC-ϕ \phi ϕ ++. The algorithm exploits Def. H.1 to allocate a smaller matrix P h P_h P h and to adjust the index boundaries of the loops performed. The body of all methods, including RemoveClass and AddClass, remains unaltered, except for the modifications that we now list, each followed by the statement certifying its correctness.
After Algorithm 4, after computing the counts n j n_j n j for j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , compute n ( 1 ) = max j ∈ [ 2 , ℓ ] n j n_{(1)}=\max_{j\in[2,\ell]}n_j n ( 1 ) = max j ∈ [ 2 , ℓ ] n j , the value H ⋆ = min { n 1 , n ( 1 ) } H^{\star}=\min\{n_1,n_{(1)}\} H ⋆ = min { n 1 , n ( 1 ) } , and the values K ( h ) K(h) K ( h ) and Φ ( h ) \Phi(h) Φ ( h ) for h ∈ [ 1 , H ⋆ ] h\in[1,H^{\star}] h ∈ [ 1 , H ⋆ ] from Def. H.1 . The counts n j n_j n j are integers and the algorithm uses only h ≤ H ⋆ h\leq H^{\star} h ≤ H ⋆ . Thus, we can use bucket sort to compute the array c [ v ] : = ∣ { j ∈ [ 2 , ℓ ] : n j = v } ∣ c[v]:=|\{j\in[2,\ell]:n_j=v\}| c [ v ] := ∣ { j ∈ [ 2 , ℓ ] : n j = v } ∣ for v ∈ [ 0 , H ⋆ − 1 ] v\in[0,H^{\star}-1] v ∈ [ 0 , H ⋆ − 1 ] , and the count c ≥ : = ∣ { j ∈ [ 2 , ℓ ] : n j ≥ H ⋆ } ∣ c_{\geq}:=|\{j\in[2,\ell]:n_j\geq H^{\star}\}| c ≥ := ∣ { j ∈ [ 2 , ℓ ] : n j ≥ H ⋆ } ∣ , in O ( ℓ + H ⋆ ) O(\ell+H^{\star}) O ( ℓ + H ⋆ ) time. Compute K ( h ) = c ≥ + ∑ v = h H ⋆ − 1 c [ v ] K(h)=c_{\geq}+\sum_{v=h}^{H^{\star}-1}c[v] K ( h ) = c ≥ + ∑ v = h H ⋆ − 1 c [ v ] for every h ∈ [ 1 , H ⋆ ] h\in[1,H^{\star}] h ∈ [ 1 , H ⋆ ] by a single scan of c c c from v = H ⋆ − 1 v=H^{\star}-1 v = H ⋆ − 1 down to v = 1 v=1 v = 1 accumulating the suffix sums. Furthermore, compute Φ ( h ) = Φ ( h − 1 ) + K ( h ) \Phi(h)=\Phi(h-1)+K(h) Φ ( h ) = Φ ( h − 1 ) + K ( h ) from K ( h ) K(h) K ( h ) and Φ ( 0 ) = 0 \Phi(0)=0 Φ ( 0 ) = 0 by Lemma H.5 (i). Since H ⋆ ≤ N ⋆ H^{\star}\leq N^{\star} H ⋆ ≤ N ⋆ , the overall time complexity is dominated by O ( ℓ + N ⋆ ) O(\ell+N^{\star}) O ( ℓ + N ⋆ ) per vote profile.
In Algorithm 4, replace the upper limit n 1 n_1 n 1 of the loop over h h h with H ⋆ = min { n 1 , n ( 1 ) } H^{\star}=\min\{n_1,n_{(1)}\} H ⋆ = min { n 1 , n ( 1 ) } , by Corollary H.4 (i).
In Algorithm 4, allocate P h P_h P h with K ( h ) + 1 K(h)+1 K ( h ) + 1 rows and Φ ( h ) + 1 \Phi(h)+1 Φ ( h ) + 1 columns, instead of ℓ \ell ℓ rows and n − n 1 + 1 n-n_1+1 n − n 1 + 1 columns, by Lemma H.5 (iii) and (iv).
In Algorithm 4, replace the upper limit ℓ − 1 \ell-1 ℓ − 1 of the loop over k k k with K ( h ) K(h) K ( h ) , by Lemma H.5 (iii).
In Algorithm 4, replace the upper limit n − n 1 n-n_1 n − n 1 of the loop over m m m with min { m ‾ ( k , h ) , Φ ( h ) } \min\{\overline{m}(k,h),\Phi(h)\} min { m ( k , h ) , Φ ( h )} , by Corollary H.4 (ii) and Lemma H.5 (iv).
In Algorithm 4, do not perform the iteration for a label y j y_j y j with n j < h n_j<h n j < h , that is, process y j y_j y j only for h ≤ min { H ⋆ , n j } h\leq\min\{H^{\star},n_j\} h ≤ min { H ⋆ , n j } , by Corollary H.4 (i). By simply processing the keys of J u n i q u e J_{\mathrm{unique}} J unique in non-increasing order of n j n_j n j , we stop the loop at the first key with n j < h n_j<h n j < h . Such an order is obtained in O ( ℓ + H ⋆ ) O(\ell+H^{\star}) O ( ℓ + H ⋆ ) time from the array c c c computed above.
In Algorithm 4, replace the upper limit ℓ − 2 \ell-2 ℓ − 2 of the loop over k k k with K − j ( h ) K_{-j}(h) K − j ( h ) , by Lemma H.5 (v).
In Algorithm 4, replace the upper limit n − ( n 1 + n j ) n-(n_1+n_j) n − ( n 1 + n j ) of the loop over m m m with min { m ‾ − j ( k , h ) , Φ ( h ) } \min\{\overline{m}_{-j}(k,h),\Phi(h)\} min { m − j ( k , h ) , Φ ( h )} , by Corollary H.4 (iii) and Lemma H.5 (v).
All above modifications, avoid the iteration over entries of P h [ k , m ] P_h[k,m] P h [ k , m ] (as used in Algorithm 4) that do not contribute towards the output of Algorithm 4, as we now show.
Lemma H.2. Let h ≥ 1 h\geq1 h ≥ 1 and let P h ( t , u ) P_h(t,u) P h ( t , u ) be the generating function of Lemma C.5.
(i) For every k ∈ { 1 , … , ℓ − 1 } k\in\{1,\ldots,\ell-1\} k ∈ { 1 , … , ℓ − 1 } and every $m\geq 0,
[ t k u m ] P h ( t , u ) = 0 whenever m < k h or m > m ‾ ( k , h ) . [t^{k}u^{m}]P_h(t,u)=0\quad\text{whenever }m<kh\text{ or }m>\overline{m}(k,h). [ t k u m ] P h ( t , u ) = 0 whenever m < k h or m > m ( k , h ) .
(ii) For every j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] , every k ∈ { 0 , … , ℓ − 2 } k \in\{0,\ldots,\ell-2\} k ∈ { 0 , … , ℓ − 2 } and every m ≥ 0 m \ge0 m ≥ 0 ,
[ t k u m ] P h ( t , u ) A j ( h ; u ) + B j ( h ; u ) t = 0 whenever m < k h or m > m ‾ − j ( k , h ) . [t^{k}u^{m}]\frac{P_h(t,u)}{A_j(h;u)+B_j(h;u)t}=0 \qquad\text{whenever } m<kh \text{ or } m>\overline{m}_{-j}(k,h). [ t k u m ] A j ( h ; u ) + B j ( h ; u ) t P h ( t , u ) = 0 whenever m < k h or m > m − j ( k , h ) .
Proof. (i) Let k ∈ { 1 , … , ℓ − 1 } k \in\{1,\ldots,\ell-1\} k ∈ { 1 , … , ℓ − 1 } , h ≥ 1 h \ge1 h ≥ 1 , by Lemma C.5 it holds that [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ [t^{k}u^{m}]P_h(t,u)=|\mathcal{S}(k,h,m)| [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ , therefore it is sufficient to show that S ( k , h , m ) = ∅ \mathcal{S}(k,h,m)=\varnothing S ( k , h , m ) = ∅ for m < k h m<kh m < k h and m > m ‾ ( k , h ) m>\overline{m}(k,h) m > m ( k , h ) .
Let S ∈ S ( k , h , m ) S \in\mathcal{S}(k,h,m) S ∈ S ( k , h , m ) , by definition we have S ⊆ C ′ S \subseteq C' S ⊆ C ′ hence y 1 ∉ M ( S ) y_1 \notin\mathcal{M}(S) y 1 ∈ / M ( S ) , and k = ∣ M ( S ) ∣ k=|\mathcal{M}(S)| k = ∣ M ( S ) ∣ . Each label of M ( S ) \mathcal{M}(S) M ( S ) receives exactly h h h votes from S S S , thus m ≥ k h m \ge kh m ≥ k h by the pigeonhole principle. Furthermore, each label y j ∈ M ( S ) y_j \in\mathcal{M}(S) y j ∈ M ( S ) satisfies n j ≥ h n_j \ge h n j ≥ h , hence min { n j , h − 1 } = h − 1 \min\{n_j,h-1\}=h-1 min { n j , h − 1 } = h − 1 , while each incorrect label y j ∉ M ( S ) y_j \notin\mathcal{M}(S) y j ∈ / M ( S ) receives at most h − 1 h-1 h − 1 votes and thus can have at most min { n j , h − 1 } \min\{n_j,h-1\} min { n j , h − 1 } classifiers in S S S , therefore
m ≤ k h + ∑ y j ∉ M ( S ) min { n j , h − 1 } = k h + Φ ( h − 1 ) − k ( h − 1 ) = k + Φ ( h − 1 ) . m \le kh+\sum_{y_j\notin\mathcal{M}(S)}\min\{n_j,h-1\}=kh+\Phi(h-1)-k(h-1)=k+\Phi(h-1). m ≤ k h + y j ∈ / M ( S ) ∑ min { n j , h − 1 } = k h + Φ ( h − 1 ) − k ( h − 1 ) = k + Φ ( h − 1 ) .
Since m = ∣ S ∣ ≤ ∣ C ′ ∣ = N m=|S|\le|C'|=N m = ∣ S ∣ ≤ ∣ C ′ ∣ = N , any S ∈ S ( k , h , m ) S\in\mathcal{S}(k,h,m) S ∈ S ( k , h , m ) must have m ≤ m ‾ ( k , h ) m\le\overline{m}(k,h) m ≤ m ( k , h ) . We have shown that S ( k , h , m ) = ∅ \mathcal{S}(k,h,m)=\varnothing S ( k , h , m ) = ∅ for every m m m outside [ k h , m ‾ ( k , h ) ] [kh,\overline{m}(k,h)] [ k h , m ( k , h )] , proving the first part of the claim.
(ii) Let k ∈ { 0 , … , ℓ − 2 } k\in\{0,\ldots,\ell-2\} k ∈ { 0 , … , ℓ − 2 } , h ≥ 1 h\ge1 h ≥ 1 , and j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , the proof is analogous to the above, by replacing S ( k , h , m ) \mathcal{S}(k,h,m) S ( k , h , m ) with the set S − j ( k , h , m ) \mathcal{S}_{-j}(k,h,m) S − j ( k , h , m ) of Corollary C.6. Note in fact, that under such scenario S ∈ S − j ( k , h , m ) S\in\mathcal{S}_{-j}(k,h,m) S ∈ S − j ( k , h , m ) can be formed by models voting for the ℓ − 2 \ell-2 ℓ − 2 incorrect labels other than y j y_j y j , and thus the sum bounding m m m above should be modified to not account for the term of label y j y_j y j . Hence any S ∈ S − j ( k , h , m ) S\in\mathcal{S}_{-j}(k,h,m) S ∈ S − j ( k , h , m ) must have m ≤ N − n j m\le N-n_j m ≤ N − n j and m ≤ k + Φ ( h − 1 ) − min { n j , h − 1 } m\le k+\Phi(h-1)-\min\{n_j,h-1\} m ≤ k + Φ ( h − 1 ) − min { n j , h − 1 } , that is m ≤ m ‾ − j ( k , h ) m\le\overline{m}_{-j}(k,h) m ≤ m − j ( k , h ) by the definition of m ‾ − j ( k , h ) \overline{m}_{-j}(k,h) m − j ( k , h ) , and m ≥ k h m\ge kh m ≥ k h by the same pigeonhole argument, proving the statement.
The above bounds are tight. Consider a vote profile with n j ≥ h n_j\ge h n j ≥ h for every j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , a coalition S S S with exactly h h h classifiers from each of the k k k incorrect labels attains m = k h m=kh m = k h , now include h − 1 h-1 h − 1 classifiers voting for each remaining incorrect label, it holds m = k h + ( ℓ − 1 − k ) ( h − 1 ) m=kh+(\ell-1-k)(h-1) m = k h + ( ℓ − 1 − k ) ( h − 1 ) and M ( S ) \mathcal{M}(S) M ( S ) remains unaltered, where Φ ( h − 1 ) = ( ℓ − 1 ) ( h − 1 ) \Phi(h-1)=(\ell-1)(h-1) Φ ( h − 1 ) = ( ℓ − 1 ) ( h − 1 ) on such a profile, hence m = k + Φ ( h − 1 ) = m ‾ ( k , h ) m=k+\Phi(h-1)=\overline{m}(k,h) m = k + Φ ( h − 1 ) = m ( k , h ) .
When the incorrect predictions are focused on few classes, most coefficients [ t k u m ] P h ( t , u ) [t^{k}u^{m}]P_h(t,u) [ t k u m ] P h ( t , u ) equal 0 0 0 . This is captured formally in the next lemma.
Lemma H.3. Let k ∈ { 1 , … , ℓ − 1 } k\in\{1,\ldots,\ell-1\} k ∈ { 1 , … , ℓ − 1 } and h ≥ 1 h\ge1 h ≥ 1 . If h > n ( k ) h>n_{(k)} h > n ( k ) , then [ t k u m ] P h ( t , u ) = 0 [t^{k}u^{m}]P_h(t,u)=0 [ t k u m ] P h ( t , u ) = 0 for every m ≥ 0 m\ge0 m ≥ 0 .
Proof. Fix k ∈ { 1 , … , ℓ − 1 } k\in\{1,\ldots,\ell-1\} k ∈ { 1 , … , ℓ − 1 } and h ≥ 1 h\ge1 h ≥ 1 . By Lemma C.5, [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ [t^{k}u^{m}]P_h(t,u)=|\mathcal{S}(k,h,m)| [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ , and every S ∈ S ( k , h , m ) S\in\mathcal{S}(k,h,m) S ∈ S ( k , h , m ) has k k k incorrect labels receiving exactly h h h votes from S ⊆ C ′ S\subseteq C' S ⊆ C ′ , thus n j ≥ h n_j\ge h n j ≥ h for each such label y j y_j y j . If h > n ( k ) h>n_{(k)} h > n ( k ) then at most k − 1 k-1 k − 1 labels j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] satisfy n j ≥ h n_j\ge h n j ≥ h , so no such S S S exists and S ( k , h , m ) = ∅ \mathcal{S}(k,h,m)=\varnothing S ( k , h , m ) = ∅ .
We now show that using the ranges of Lemma H.2 and Lemma H.3 our Theorem 4.8 retains its correctness.
Corollary H.4. Let H ⋆ = min { n 1 , n ( 1 ) } H^\star=\min\{n_1,n_{(1)}\} H ⋆ = min { n 1 , n ( 1 ) } . The statement of Theorem 4.8 holds with the following modifications.
(i) Replace the upper limit of the summation over h h h , which is n 1 n_1 n 1 in the first identity and n j n_j n j in the second, by H ⋆ H^\star H ⋆ and by min { H ⋆ , n j } = min { n 1 , n j } \min\{H^\star,n_j\}=\min\{n_1,n_j\} min { H ⋆ , n j } = min { n 1 , n j } , respectively.
(ii) For a correct classifier replace the upper limit n − n 1 n-n_1 n − n 1 over m m m with m ‾ ( k , h ) \overline{m}(k,h) m ( k , h ) .
(iii) For an incorrect classifier predicting y j y_j y j replace the upper limit n − ( n 1 + n j ) n-(n_1+n_j) n − ( n 1 + n j ) over m m m with m ‾ − j ( k , h ) \overline{m}_{-j}(k,h) m − j ( k , h ) .
Proof. (i) Consider the two sums defining the Shapley value from Theorem 4.8. The summation in h h h for the Shapley value of a correct classifier has upper limit n 1 n_1 n 1 , and all terms for h > n ( 1 ) h>n_{(1)} h > n ( 1 ) are zero since k ≥ 1 k\ge1 k ≥ 1 and n ( k ) ≤ n ( 1 ) n_{(k)}\le n_{(1)} n ( k ) ≤ n ( 1 ) thus by Lemma H.3 it holds [ t k u m ] P h ( t , u ) = 0 [t^{k}u^{m}]P_h(t,u)=0 [ t k u m ] P h ( t , u ) = 0 .
Similarly, the summation in h h h for the Shapley value of an incorrect classifier has upper limit n j ≤ n ( 1 ) n_j\le n_{(1)} n j ≤ n ( 1 ) , and its terms with h > n 1 h>n_1 h > n 1 are zero, since ( n 1 h ) = 0 \binom{n_1}{h}=0 ( h n 1 ) = 0 by the definition
of f j f_j f j in § 4.2.2 . Therefore the two summations are restricted to h ≤ H ⋆ h \le H^\star h ≤ H ⋆ and to h ≤ min { n 1 , n j } h \le\min\{n_1,n_j\} h ≤ min { n 1 , n j } respectively, both of which retain the correctness of Theorem 4.8 , proving the first part of the claim.
( i i ) (ii) ( ii ) and ( i i i ) (iii) ( iii ) Both substitutions truncate the two sums, note m ‾ ( k , h ) ≤ n − n 1 \overline{m}(k,h) \le n-n_1 m ( k , h ) ≤ n − n 1 and m ‾ − j ( k , h ) ≤ n − ( n 1 + n j ) \overline{m}_{-j}(k,h) \le n-(n_1+n_j) m − j ( k , h ) ≤ n − ( n 1 + n j ) by definition. By Lemma H.2 , every truncated term contributes a factor [ t k u m ] P h ( t , u ) [t^ku^m]P_h(t,u) [ t k u m ] P h ( t , u ) , respectively [ t k u m ] P h ( t , u ) / ( A j ( h ; u ) + B j ( h ; u ) t ) [t^ku^m]P_h(t,u)/(A_j(h;u)+B_j(h;u)t) [ t k u m ] P h ( t , u ) / ( A j ( h ; u ) + B j ( h ; u ) t ) , equal to zero. This concludes the proof.
The modification of Algorithm 4 uses the bound min { H ⋆ , n j } \min\{H^\star,n_j\} min { H ⋆ , n j } of Corollary H.4 (i). For simplicity, our analysis of Theorem H.7 uses the weaker bound H ⋆ H^\star H ⋆ , which is common to all the incorrect labels and can be used as common bound for the iterations of the loop of Algorithm 4.
As mentioned, ENPOWERMC-ϕ \phi ϕ ++ builds at each iteration h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] a matrix of size ( K ( h ) + 1 ) × ( Φ ( h ) + 1 ) (K(h)+1)\times(\Phi(h)+1) ( K ( h ) + 1 ) × ( Φ ( h ) + 1 ) to retain the non-zero coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) , we now show the key combinatorial identities allowing such construction, and connect K ( h ) K(h) K ( h ) and Φ ( h ) \Phi(h) Φ ( h ) .
Lemma H.5. Let H = n ( 1 ) H=n_{(1)} H = n ( 1 ) , H ⋆ = min { n 1 , n ( 1 ) } H^\star=\min\{n_1,n_{(1)}\} H ⋆ = min { n 1 , n ( 1 ) } and fix h ≥ 1 h\ge1 h ≥ 1 . The following hold.
( i ) (i) ( i ) K ( h ) = Φ ( h ) − Φ ( h − 1 ) K(h)=\Phi(h)-\Phi(h-1) K ( h ) = Φ ( h ) − Φ ( h − 1 ) .
( i i ) (ii) ( ii ) Φ ( H ) = N \Phi(H)=N Φ ( H ) = N and Φ ( h ′ ) ≤ N \Phi(h')\le N Φ ( h ′ ) ≤ N for every h ′ ≥ 0 h'\ge0 h ′ ≥ 0 .
( i i i ) (iii) ( iii ) [ t k u m ] P h ( t , u ) = 0 [t^ku^m]P_h(t,u)=0 [ t k u m ] P h ( t , u ) = 0 for every k > K ( h ) k>K(h) k > K ( h ) and every m ≥ 0 m\ge0 m ≥ 0 .
( i v ) (iv) ( i v ) [ t k u m ] P h ( t , u ) = 0 [t^ku^m]P_h(t,u)=0 [ t k u m ] P h ( t , u ) = 0 for every m > Φ ( h ) m>\Phi(h) m > Φ ( h ) and every k ≥ 0 k\ge0 k ≥ 0 .
( v ) (v) ( v ) For every j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , with K − j ( h ) K_{-j}(h) K − j ( h ) as in Def. H.1 ,
[ t k u m ] P h ( t , u ) A j ( h ; u ) + B j ( h ; u ) t = 0 [t^ku^m]\frac{P_h(t,u)}{A_j(h;u)+B_j(h;u)t}=0 [ t k u m ] A j ( h ; u ) + B j ( h ; u ) t P h ( t , u ) = 0 for every k > K − j ( h ) k>K_{-j}(h) k > K − j ( h ) and every m ≥ 0 m\ge0 m ≥ 0 , and for every m > Φ ( h ) − min { n j , h } m>\Phi(h)-\min\{n_j,h\} m > Φ ( h ) − min { n j , h } and every $k\ge 0.
Proof. We prove ( i ) (i) ( i ) . Let a ≥ 0 a\ge0 a ≥ 0 and h ≥ 1 h\ge1 h ≥ 1 . If a ≥ h a\ge h a ≥ h then min { a , h } − min { a , h − 1 } = h − ( h − 1 ) = 1 \min\{a,h\}-\min\{a,h-1\}=h-(h-1)=1 min { a , h } − min { a , h − 1 } = h − ( h − 1 ) = 1 . If a ≤ h − 1 a\le h-1 a ≤ h − 1 then min { a , h } − min { a , h − 1 } = a − a = 0 \min\{a,h\}-\min\{a,h-1\}=a-a=0 min { a , h } − min { a , h − 1 } = a − a = 0 . Therefore, min { a , h } − min { a , h − 1 } = 1 [ a ≥ h ] \min\{a,h\}-\min\{a,h-1\}=\mathbb{1}[a\ge h] min { a , h } − min { a , h − 1 } = 1 [ a ≥ h ] . Hence,
Φ ( h ) − Φ ( h − 1 ) = ∑ j = 2 ℓ 1 [ n j ≥ h ] = K ( h ) , \Phi(h)-\Phi(h-1)=\sum_{j=2}^{\ell}\mathbb{1}[n_j\ge h]=K(h), Φ ( h ) − Φ ( h − 1 ) = j = 2 ∑ ℓ 1 [ n j ≥ h ] = K ( h ) ,
where the first equality uses the above identity, and the second equality is from the definition of K ( h ) K(h) K ( h ) , proving ( i ) (i) ( i ) .
We prove ( i i ) (ii) ( ii ) . By the definition of H H H we have n j ≤ H n_j\le H n j ≤ H for every j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] , hence min { n j , H } = n j \min\{n_j,H\}=n_j min { n j , H } = n j and Φ ( H ) = ∑ j = 2 ℓ n j = N \Phi(H)=\sum_{j=2}^{\ell}n_j=N Φ ( H ) = ∑ j = 2 ℓ n j = N . Furthermore, the function Φ ( h ) \Phi(h) Φ ( h ) is non-decreasing in h h h , thus Φ ( h ) ≤ Φ ( H ) = N \Phi(h)\le\Phi(H)=N Φ ( h ) ≤ Φ ( H ) = N for h ≤ H h\le H h ≤ H , and Φ ( h ) = N \Phi(h)=N Φ ( h ) = N for h > H h>H h > H , proving ( i i ) (ii) ( ii ) .
We prove ( i i i ) (iii) ( iii ) . By the definition of K ( h ) K(h) K ( h ) , at most K ( h ) K(h) K ( h ) labels j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] satisfy n j ≥ h n_j\ge h n j ≥ h , thus n ( k ) < h n_{(k)}<h n ( k ) < h for every k > K ( h ) k>K(h) k > K ( h ) . The claim then follows from Lemma H.3 , proving ( i i i ) (iii) ( iii ) .
We prove ( i v ) (iv) ( i v ) . By Lemma C.5, [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ [t^ku^m]P_h(t,u)=|\mathcal{S}(k,h,m)| [ t k u m ] P h ( t , u ) = ∣ S ( k , h , m ) ∣ . Fix k ≥ 0 k\ge0 k ≥ 0 , h ≥ 1 h\ge1 h ≥ 1 , m ≥ 0 m\ge0 m ≥ 0 and S ∈ S ( k , h , m ) S\in\mathcal{S}(k,h,m) S ∈ S ( k , h , m ) , each label of M ( S ) \mathcal{M}(S) M ( S ) receives exactly h h h votes from S S S and each incorrect label not in M ( S ) \mathcal{M}(S) M ( S ) receives at most h − 1 h-1 h − 1 votes. Thus S S S contains at most min { n j , h } \min\{n_j,h\} min { n j , h } classifiers predicting y j y_j y j , for every j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] . If m = ∣ S ∣ ≤ Φ ( h ) m=|S|\le\Phi(h) m = ∣ S ∣ ≤ Φ ( h ) , hence S ( k , h , m ) = ∅ \mathcal{S}(k,h,m)=\varnothing S ( k , h , m ) = ∅ for every m > Φ ( h ) m>\Phi(h) m > Φ ( h ) , proving ( i v ) (iv) ( i v ) .
We prove ( v ) (v) ( v ) . Fix j ∈ [ 2 , ℓ ) j\in[2,\ell) j ∈ [ 2 , ℓ ) . By Corollary C.6 it holds [ t k u m ] P h ( t , u ) / ( A j ( h ; u ) + B j ( h ; u ) t ) = ∣ S − j ( k , h , m ) ∣ [t^ku^m]P_h(t,u)/(A_j(h;u)+B_j(h;u)t)=|\mathcal{S}_{-j}(k,h,m)| [ t k u m ] P h ( t , u ) / ( A j ( h ; u ) + B j ( h ; u ) t ) = ∣ S − j ( k , h , m ) ∣ , where a coalition S ∈ S − j ( k , h , m ) S\in\mathcal{S}_{-j}(k,h,m) S ∈ S − j ( k , h , m ) contains no classifier predicting y j y_j y j . Each label of M ( S ) \mathcal{M}(S) M ( S ) receives exactly h h h votes from S S S , hence it corresponds to a label y j ′ y_{j'} y j ′ with j ′ ≠ j j'\ne j j ′ = j and n j ′ ≥ h n_{j'}\ge h n j ′ ≥ h , for which there are K − j ( h ) K_{-j}(h) K − j ( h ) such labels by Def. H.1 , thus S − j ( k , h , m ) = ∅ \mathcal{S}_{-j}(k,h,m)=\varnothing S − j ( k , h , m ) = ∅ for every k > K − j ( h ) k>K_{-j}(h) k > K − j ( h ) . Furthermore, S S S contains at most min { n j ′ , h } \min\{n_{j'},h\} min { n j ′ , h } classifiers predicting y j ′ y_{j'} y j ′ for every j ′ ≠ j j'\ne j j ′ = j by the argument of ( i v ) (iv) ( i v ) , thus m = ∣ S ∣ ≤ ∑ j ′ ≠ j min { n j ′ , h } = Φ ( h ) − min { n j , h } m=|S|\le\sum_{j'\ne j}\min\{n_{j'},h\}=\Phi(h)-\min\{n_j,h\} m = ∣ S ∣ ≤ ∑ j ′ = j min { n j ′ , h } = Φ ( h ) − min { n j , h } , proving ( v ) (v) ( v ) and concluding the proof.
We now need a final technical lemma used to prove our main bound on the time complexity of ENPOWERMC-ϕ \phi ϕ ++.
Lemma H.6. Fix H ⋆ = min { n 1 , n ( 1 ) } H^\star= \min\{n_1,n_{(1)}\} H ⋆ = min { n 1 , n ( 1 ) } and let N ⋆ = Φ ( H ⋆ ) N^\star= \Phi(H^\star) N ⋆ = Φ ( H ⋆ ) . Then
( N ⋆ ) 3 3 ≤ ∑ h = 1 H ⋆ K ( h ) Φ ( h ) 2 ≤ ( N ⋆ ) 3 3 + 2 ℓ ( N ⋆ ) 2 . \frac{(N^\star)^3}{3} \le\sum_{h=1}^{H^\star} K(h)\Phi(h)^2 \le\frac{(N^\star)^3}{3} + 2\ell(N^\star)^2. 3 ( N ⋆ ) 3 ≤ h = 1 ∑ H ⋆ K ( h ) Φ ( h ) 2 ≤ 3 ( N ⋆ ) 3 + 2 ℓ ( N ⋆ ) 2 . Proof. First note that the function Φ ( h ) \Phi(h) Φ ( h ) is non-decreasing in h h h and Φ ( 0 ) = 0 \Phi(0) = 0 Φ ( 0 ) = 0 , furthermore Φ ( H ⋆ ) = N ⋆ \Phi(H^\star) = N^\star Φ ( H ⋆ ) = N ⋆ by the definition of N ⋆ N^\star N ⋆ . Now consider the sets
X h : = { x ∈ Z : Φ ( h − 1 ) < x ≤ Φ ( h ) } , X_h := \{x \in\mathbb{Z} : \Phi(h-1) < x \le\Phi(h)\}, X h := { x ∈ Z : Φ ( h − 1 ) < x ≤ Φ ( h )} , for h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] . Sets X h X_h X h form a partition of the set Z = { 1 , … , N ⋆ } Z = \{1,\ldots,N^\star\} Z = { 1 , … , N ⋆ } . For any x ∈ Z x \in Z x ∈ Z we let col ( x ) ∈ [ 1 , H ⋆ ] \operatorname{col}(x) \in[1,H^\star] col ( x ) ∈ [ 1 , H ⋆ ] be the unique index such that x ∈ X col ( x ) x \in X_{\operatorname{col}(x)} x ∈ X col ( x ) . The sets X h X_h X h contains exactly Φ ( h ) − Φ ( h − 1 ) \Phi(h)-\Phi(h-1) Φ ( h ) − Φ ( h − 1 ) integers, and therefore by Lemma H.5 (i) ∣ X h ∣ = K ( h ) |X_h| = K(h) ∣ X h ∣ = K ( h ) , thus col ( x ) \operatorname{col}(x) col ( x ) takes the value h h h for exactly K ( h ) K(h) K ( h ) indices x ∈ Z x \in Z x ∈ Z . Hence
∑ h = 1 H ⋆ K ( h ) Φ ( h ) 2 = ∑ h = 1 H ⋆ ∑ x ∈ X h Φ ( h ) 2 = ∑ x = 1 N ⋆ Φ ( col ( x ) ) 2 , (34) \sum_{h=1}^{H^\star} K(h)\Phi(h)^2 = \sum_{h=1}^{H^\star}\sum_{x\in X_h}\Phi(h)^2 = \sum_{x=1}^{N^\star}\Phi(\operatorname{col}(x))^2, \tag*{(34)} h = 1 ∑ H ⋆ K ( h ) Φ ( h ) 2 = h = 1 ∑ H ⋆ x ∈ X h ∑ Φ ( h ) 2 = x = 1 ∑ N ⋆ Φ ( col ( x ) ) 2 , (34) where the first equality follows by ∣ X h ∣ = K ( h ) |X_h| = K(h) ∣ X h ∣ = K ( h ) and in the last equality we grouped the terms of the summation by their value of col ( x ) \operatorname{col}(x) col ( x ) , and used the fact that X h X_h X h , h ≥ 1 h \ge1 h ≥ 1 forms a partition of Z Z Z .
We now prove the lower bound. By the definition of col ( x ) \operatorname{col}(x) col ( x ) we have x ≤ Φ ( col ( x ) ) x \le\Phi(\operatorname{col}(x)) x ≤ Φ ( col ( x )) , hence Φ ( col ( x ) ) 2 ≥ x 2 \Phi(\operatorname{col}(x))^2 \ge x^2 Φ ( col ( x ) ) 2 ≥ x 2 . Thus
∑ h = 1 H ⋆ K ( h ) Φ ( h ) 2 ≥ ∑ x = 1 N ⋆ x 2 = ( N ⋆ ) 3 3 + ( N ⋆ ) 2 2 + N ⋆ 6 ≥ ( N ⋆ ) 3 3 , \sum_{h=1}^{H^\star} K(h)\Phi(h)^2 \ge\sum_{x=1}^{N^\star}x^2 = \frac{(N^\star)^3}{3}+\frac{(N^\star)^2}{2}+\frac{N^\star}{6} \ge\frac{(N^\star)^3}{3}, h = 1 ∑ H ⋆ K ( h ) Φ ( h ) 2 ≥ x = 1 ∑ N ⋆ x 2 = 3 ( N ⋆ ) 3 + 2 ( N ⋆ ) 2 + 6 N ⋆ ≥ 3 ( N ⋆ ) 3 , where the first inequality follows by Eq. (34) , and the equality follows by the well known sum ∑ h = 1 a x 2 = a ( a + 1 ) ( 2 a + 1 ) / 6 \sum_{h=1}^{a}x^2 = a(a+1)(2a+1)/6 ∑ h = 1 a x 2 = a ( a + 1 ) ( 2 a + 1 ) /6 , a ≥ 1 a \ge1 a ≥ 1 .
We conclude proving the upper bound. By the definition of col ( x ) \operatorname{col}(x) col ( x ) we have x > Φ ( col ( x ) − 1 ) x > \Phi(\operatorname{col}(x)-1) x > Φ ( col ( x ) − 1 ) , and Φ ( col ( x ) − 1 ) = Φ ( col ( x ) ) − K ( col ( x ) ) \Phi(\operatorname{col}(x)-1) = \Phi(\operatorname{col}(x)) - K(\operatorname{col}(x)) Φ ( col ( x ) − 1 ) = Φ ( col ( x )) − K ( col ( x )) by Lemma H.5 (i). By the above
K ( col ( x ) ) = Φ ( col ( x ) ) − Φ ( col ( x ) − 1 ) > Φ ( col ( x ) ) − x , K(\operatorname{col}(x)) = \Phi(\operatorname{col}(x))-\Phi(\operatorname{col}(x)-1) > \Phi(\operatorname{col}(x))-x, K ( col ( x )) = Φ ( col ( x )) − Φ ( col ( x ) − 1 ) > Φ ( col ( x )) − x , and thus Φ ( col ( x ) ) − x ≤ K ( col ( x ) ) − 1 \Phi(\operatorname{col}(x))-x \le K(\operatorname{col}(x))-1 Φ ( col ( x )) − x ≤ K ( col ( x )) − 1 since x x x , Φ ( col ( x ) ) \Phi(\operatorname{col}(x)) Φ ( col ( x )) and K ( col ( x ) ) K(\operatorname{col}(x)) K ( col ( x )) are integers.
Now note
Φ ( col ( x ) ) 2 − x 2 = ( Φ ( col ( x ) ) − x ) ( Φ ( col ( x ) ) + x ) ≤ 2 N ⋆ ( K ( col ( x ) ) − 1 ) , \Phi(\operatorname{col}(x))^2-x^2 = (\Phi(\operatorname{col}(x))-x)(\Phi(\operatorname{col}(x))+x) \le2N^\star(K(\operatorname{col}(x))-1), Φ ( col ( x ) ) 2 − x 2 = ( Φ ( col ( x )) − x ) ( Φ ( col ( x )) + x ) ≤ 2 N ⋆ ( K ( col ( x )) − 1 ) , where we used Φ ( col ( x ) ) ≤ Φ ( H ⋆ ) = N ⋆ \Phi(\operatorname{col}(x)) \le\Phi(H^\star) = N^\star Φ ( col ( x )) ≤ Φ ( H ⋆ ) = N ⋆ and x ≤ N ⋆ x \le N^\star x ≤ N ⋆ . Consider the following sum
∑ x = 1 N ⋆ ( Φ ( col ( x ) ) 2 − x 2 ) ≤ 2 N ⋆ ∑ h = 1 H ⋆ K ( h ) ( K ( h ) − 1 ) \sum_{x=1}^{N^\star}\left(\Phi(\operatorname{col}(x))^2-x^2\right) \le2N^\star\sum_{h=1}^{H^\star}K(h)(K(h)-1) x = 1 ∑ N ⋆ ( Φ ( col ( x ) ) 2 − x 2 ) ≤ 2 N ⋆ h = 1 ∑ H ⋆ K ( h ) ( K ( h ) − 1 ) ≤ 2 N ⋆ ( ℓ − 2 ) ∑ h = 1 H ⋆ K ( h ) = 2 ( N ⋆ ) 2 ( ℓ − 2 ) , \le2N^\star(\ell-2)\sum_{h=1}^{H^\star}K(h) = 2(N^\star)^2(\ell-2), ≤ 2 N ⋆ ( ℓ − 2 ) h = 1 ∑ H ⋆ K ( h ) = 2 ( N ⋆ ) 2 ( ℓ − 2 ) , the first inequality follows from the above bound and by grouping the terms by their value of col ( x ) ∈ [ 1 , H ⋆ ] \operatorname{col}(x) \in[1,H^\star] col ( x ) ∈ [ 1 , H ⋆ ] , where for fixed h h h there are exactly K ( h ) K(h) K ( h ) such terms (i.e., ∣ X h ∣ = K ( h ) |X_h| = K(h) ∣ X h ∣ = K ( h ) ). The second inequality follows since K ( h ) ≤ ℓ − 1 K(h) \le\ell-1 K ( h ) ≤ ℓ − 1 and the final equality uses ∑ h = 1 H ⋆ K ( h ) = Φ ( H ⋆ ) − Φ ( 0 ) = N ⋆ \sum_{h=1}^{H^\star}K(h) = \Phi(H^\star)-\Phi(0) = N^\star ∑ h = 1 H ⋆ K ( h ) = Φ ( H ⋆ ) − Φ ( 0 ) = N ⋆ . From Eq. (34) we have that ∑ h = 1 H ⋆ K ( h ) Φ ( h ) 2 = ∑ x = 1 N ⋆ x 2 + ∑ x = 1 N ⋆ ( Φ ( col ( x ) ) 2 − x 2 ) \sum_{h=1}^{H^\star}K(h)\Phi(h)^2 = \sum_{x=1}^{N^\star}x^2+\sum_{x=1}^{N^\star}(\Phi(\operatorname{col}(x))^2-x^2) ∑ h = 1 H ⋆ K ( h ) Φ ( h ) 2 = ∑ x = 1 N ⋆ x 2 + ∑ x = 1 N ⋆ ( Φ ( col ( x ) ) 2 − x 2 ) , thus
∑ h = 1 H ⋆ K ( h ) Φ ( h ) 2 ≤ ( N ⋆ ) 3 3 + ( N ⋆ ) 2 + 2 ( N ⋆ ) 2 ( ℓ − 2 ) ≤ ( N ⋆ ) 3 3 + 2 ℓ ( N ⋆ ) 2 , \sum_{h=1}^{H^\star}K(h)\Phi(h)^2 \le\frac{(N^\star)^3}{3}+(N^\star)^2+2(N^\star)^2(\ell-2) \le\frac{(N^\star)^3}{3}+2\ell(N^\star)^2, h = 1 ∑ H ⋆ K ( h ) Φ ( h ) 2 ≤ 3 ( N ⋆ ) 3 + ( N ⋆ ) 2 + 2 ( N ⋆ ) 2 ( ℓ − 2 ) ≤ 3 ( N ⋆ ) 3 + 2 ℓ ( N ⋆ ) 2 , where we used the well known bound ∑ x = 1 N ⋆ x 2 ≤ ( N ⋆ ) 3 / 3 + ( N ⋆ ) 2 \sum_{x=1}^{N^\star}x^2 \le(N^\star)^3/3+(N^\star)^2 ∑ x = 1 N ⋆ x 2 ≤ ( N ⋆ ) 3 /3 + ( N ⋆ ) 2 , which holds for every N ⋆ ≥ 1 N^\star\ge1 N ⋆ ≥ 1 , which concludes the proof.
The above identity will be used to bound the total number of operations performed by ENPOWERMC-ϕ \phi ϕ ++ at each of its iterations h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] . To obtain a final bound for the processing of the full dataset D D D we need the following definition, let N ~ = max ( x , y ) ∈ D N x ⋆ \widetilde{N} = \max_{(x,y)\in D} N^\star_x N = max ( x , y ) ∈ D N x ⋆ , where N x ⋆ N^\star_x N x ⋆ depends on the vote profile for x x x (recall that we fixed a single data point ( x , y ) (x,y) ( x , y ) up to now). We can now prove the time complexity of ENPOWERMC-ϕ \phi ϕ ++.
Theorem H.7. Consider ENPOWERMC-ϕ \phi ϕ ++ (Algorithm 4 modified as listed in Sec. H.1), its output coincides with the output of Algorithm 4, and its time complexity to compute the Shapley values for all classifiers in C C C in the game G D G_D G D for a dataset D D D is bounded by
O ( ∣ U ∣ ( ( N ~ ) 3 + ℓ ( N ~ ) 2 ) + ∣ D ∣ n ) , \mathcal{O}\left(|U|((\widetilde{N})^3+\ell(\widetilde{N})^2)+|D|n\right), O ( ∣ U ∣ (( N ) 3 + ℓ ( N ) 2 ) + ∣ D ∣ n ) , and its memory complexity is bounded by O ( ∣ U ∣ ℓ + ℓ N ~ ) \mathcal{O}(|U|\ell+\ell\widetilde{N}) O ( ∣ U ∣ ℓ + ℓ N ) .
Proof. The output of ENPOWERMC-ϕ \phi ϕ ++ corresponds to the output of Algorithm 4 by Corollary H.4 .
We now bound the time complexity. As in the proof of Theorem 4.9 , by symmetry it is sufficient to compute the values ϕ i \phi_i ϕ i , i ∈ [ n ] i \in[n] i ∈ [ n ] for the data points in D D D with unique vote profile p ∈ U p \in U p ∈ U , and evaluating the predictions of all classifiers over D D D has time complexity O ( ∣ D ∣ n ) \mathcal{O}(|D|n) O ( ∣ D ∣ n ) . Fix one data point ( x , y ) ∈ D (x,y) \in D ( x , y ) ∈ D with its vote profile, and let H ⋆ = H x ⋆ H^\star=H^\star_x H ⋆ = H x ⋆ and N ⋆ = N x ⋆ N^\star=N^\star_x N ⋆ = N x ⋆ for ease of notation.
Fix an iteration h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] of ENPOWERMC-ϕ \phi ϕ ++, then the matrix retaining the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) has size ( K ( h ) + 1 ) × ( Φ ( h ) + 1 ) (K(h)+1)\times(\Phi(h)+1) ( K ( h ) + 1 ) × ( Φ ( h ) + 1 ) . For each j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] the polynomial A j ( h ; u ) A_j(h;u) A j ( h ; u ) has at most min { h , n j + 1 } \min\{h,n_j+1\} min { h , n j + 1 } non-zero coefficients and B j ( h ; u ) B_j(h;u) B j ( h ; u ) has at most one, thus multiplying the matrix by A j ( h ; u ) + B j ( h ; u ) t A_j(h;u)+B_j(h;u)t A j ( h ; u ) + B j ( h ; u ) t requires O ( K ( h ) Φ ( h ) min { n j , h } ) \mathcal{O}(K(h)\Phi(h)\min\{n_j,h\}) O ( K ( h ) Φ ( h ) min { n j , h }) operations. Summing over the labels and using ∑ j = 2 ℓ min { n j , h } = Φ ( h ) \sum_{j=2}^{\ell}\min\{n_j,h\}=\Phi(h) ∑ j = 2 ℓ min { n j , h } = Φ ( h ) , the matrix is computed in O ( K ( h ) Φ ( h ) 2 ) \mathcal{O}(K(h)\Phi(h)^2) O ( K ( h ) Φ ( h ) 2 ) operations. The terms contributing to the Shapley value of a correct classifier require then O ( K ( h ) Φ ( h ) ) \mathcal{O}(K(h)\Phi(h)) O ( K ( h ) Φ ( h )) operations, by a simple linear scan of the matrix. For an incorrect label j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] the division and the multiplication with A j ( h ; u ) + B j ( h ; u ) t A_j(h;u)+B_j(h;u)t A j ( h ; u ) + B j ( h ; u ) t are dominated by the construction of the matrix, hence the time complexity of processing all incorrect labels is bounded by O ( ℓ K ( h ) Φ ( h ) + K ( h ) Φ ( h ) 2 ) \mathcal{O}(\ell K(h)\Phi(h)+K(h)\Phi(h)^2) O ( ℓ K ( h ) Φ ( h ) + K ( h ) Φ ( h ) 2 ) .
Now observe that H ⋆ ≤ N ⋆ H^\star\leq N^\star H ⋆ ≤ N ⋆ , since the term of N ⋆ N^\star N ⋆ indexed by a label j j j attaining n j = n ( 1 ) n_j=n_{(1)} n j = n ( 1 ) equals min { n ( 1 ) , n 1 } = H ⋆ \min\{n_{(1)},n_1\}=H^\star min { n ( 1 ) , n 1 } = H ⋆ , and every term of N ⋆ N^\star N ⋆ is non-negative. Iterating over the labels for any fixed h h h has O ( ℓ ) \mathcal{O}(\ell) O ( ℓ ) time complexity contributing O ( ℓ H ⋆ ) = O ( ℓ N ⋆ ) \mathcal{O}(\ell H^\star)=\mathcal{O}(\ell N^\star) O ( ℓ H ⋆ ) = O ( ℓ N ⋆ ) over the iterations of ENPOWERMC-ϕ \phi ϕ ++. Furthermore, note that ℓ + H ⋆ = O ( ℓ N ⋆ ) \ell+H^\star=\mathcal{O}(\ell N^\star) ℓ + H ⋆ = O ( ℓ N ⋆ ) , thus the complexity of bucket sort is dominated by the above. Summing the costs over the iterations we have
∑ h = 1 H ⋆ O ( K ( h ) Φ ( h ) 2 + ℓ K ( h ) Φ ( h ) + O ( ℓ N ⋆ ) ) = O ( ( N ⋆ ) 3 + ℓ ( N ⋆ ) 2 ) , \sum_{h=1}^{H^\star}\mathcal{O}\left(K(h)\Phi(h)^2+\ell K(h)\Phi(h)+\mathcal{O}(\ell N^\star)\right)=\mathcal{O}\left((N^\star)^3+\ell(N^\star)^2\right), h = 1 ∑ H ⋆ O ( K ( h ) Φ ( h ) 2 + ℓ K ( h ) Φ ( h ) + O ( ℓ N ⋆ ) ) = O ( ( N ⋆ ) 3 + ℓ ( N ⋆ ) 2 ) ,
where we used Lemma H.6 and
∑ h = 1 H ⋆ K ( h ) Φ ( h ) ≤ N ⋆ ∑ h = 1 H ⋆ K ( h ) = ( N ⋆ ) 2 , \sum_{h=1}^{H^\star}K(h)\Phi(h)\leq N^\star\sum_{h=1}^{H^\star}K(h)=(N^\star)^2, h = 1 ∑ H ⋆ K ( h ) Φ ( h ) ≤ N ⋆ h = 1 ∑ H ⋆ K ( h ) = ( N ⋆ ) 2 ,
which holds since Φ ( h ) ≤ Φ ( H ⋆ ) = N ⋆ \Phi(h)\leq\Phi(H^\star)=N^\star Φ ( h ) ≤ Φ ( H ⋆ ) = N ⋆ and ∑ h = 1 H ⋆ K ( h ) = Φ ( H ⋆ ) − Φ ( 0 ) \sum_{h=1}^{H^\star}K(h)=\Phi(H^\star)-\Phi(0) ∑ h = 1 H ⋆ K ( h ) = Φ ( H ⋆ ) − Φ ( 0 ) by Lemma H.5 (i).
Now consider the processing of the entire dataset D D D , for each point ( x , y ) ∈ D (x,y)\in D ( x , y ) ∈ D we have N x ⋆ ≤ N ~ N^\star_x\leq\widetilde{N} N x ⋆ ≤ N by definition. Thus, summing over the vote profiles of U U U and considering the evaluation of the votes of all classifiers, the time complexity to compute ϕ i \phi_i ϕ i , i ∈ [ n ] i\in[n] i ∈ [ n ] is bounded by
O ( ∣ U ∣ ( ( N ~ ) 3 + ℓ ( N ~ ) 2 ) + ∣ D ∣ n ) , \mathcal{O}\left(|U|((\widetilde{N})^3+\ell(\widetilde{N})^2)+|D|n\right), O ( ∣ U ∣ (( N ) 3 + ℓ ( N ) 2 ) + ∣ D ∣ n ) ,
proving our main result.
Finally, note that the memory complexity is dominated by storing the largest matrix across all data points in D D D thus O ( K ( h ) Φ ( h ) ) = O ( ℓ N ~ ) \mathcal{O}(K(h)\Phi(h))=\mathcal{O}(\ell\widetilde{N}) O ( K ( h ) Φ ( h )) = O ( ℓ N ) , and the O ( ∣ U ∣ ℓ ) \mathcal{O}(|U|\ell) O ( ∣ U ∣ ℓ ) values of the unique vote profile, and the output, as in the proof of Theorem 4.9 , which concludes the proof. □ \square □
We now show that the time complexity of ENPOWERMC-ϕ \phi ϕ ++ improves over that of Algorithm 4.
Corollary H.8. Recall that N ⋆ = ∑ j = 2 ℓ min { n j , n 1 } N^{\star} = \sum_{j=2}^{\ell} \min\{n_j,n_1\} N ⋆ = ∑ j = 2 ℓ min { n j , n 1 } . For the processing of a unique vote profile of a fixed data point ( x , y ) ∈ D (x,y) \in D ( x , y ) ∈ D with N ⋆ ≥ ℓ N^{\star} \ge\ell N ⋆ ≥ ℓ , the time complexity of E N P O W E R M C − ϕ + + \mathrm{ENPOWER}_{\mathrm{MC}-\phi++} ENPOWER MC − ϕ ++ improves on the bound of Theorem 4.9 by a factor
Θ ( ℓ ( n N ⋆ ) 3 ) , \Theta\left(\ell\left(\frac{n}{N^{\star}}\right)^3\right), Θ ( ℓ ( N ⋆ n ) 3 ) , that is, the improvement is
Ω ( max { ℓ ( n n − n 1 ) 3 , n 3 ℓ 2 n 1 3 } ) . \Omega\left(\max\left\{\ell\left(\frac{n}{n-n_1}\right)^3,\frac{n^3}{\ell^2 n_1^3}\right\}\right). Ω ( max { ℓ ( n − n 1 n ) 3 , ℓ 2 n 1 3 n 3 } ) .
Proof. By the hypothesis we have N ⋆ ≥ ℓ N^{\star} \ge\ell N ⋆ ≥ ℓ . Thus, ℓ ( N ⋆ ) 2 ≤ ( N ⋆ ) 3 \ell(N^{\star})^2 \le(N^{\star})^3 ℓ ( N ⋆ ) 2 ≤ ( N ⋆ ) 3 , and the bound on the time complexity of E N P O W E R M C − ϕ + + \mathrm{ENPOWER}_{\mathrm{MC}-\phi++} ENPOWER MC − ϕ ++ from Theorem H.7 becomes O ( ( N ⋆ ) 3 ) O((N^{\star})^3) O (( N ⋆ ) 3 ) , for a single data point.
Now recall that by Theorem 4.9 , the complexity of Algorithm 4 to process a single data point (i.e., unique vote profile) is bounded by O ( ℓ n 3 ) O(\ell n^3) O ( ℓ n 3 ) . Thus the improvement, evaluated by the ratio of the bounds is ℓ n 3 ( N ⋆ ) 3 \frac{\ell n^3}{(N^{\star})^3} ( N ⋆ ) 3 ℓ n 3 , yielding the first claim.
The second claim follows by upper bounding N ⋆ N^{\star} N ⋆ with min { n − n 1 , ( ℓ − 1 ) n 1 } \min\{n-n_1,(\ell-1)n_1\} min { n − n 1 , ( ℓ − 1 ) n 1 } , as already shown. Substituting such a bound in ℓ n 3 ( N ⋆ ) 3 \frac{\ell n^3}{(N^{\star})^3} ( N ⋆ ) 3 ℓ n 3 yields
ℓ n 3 min { n − n 1 , ( ℓ − 1 ) n 1 } 3 = max { ℓ ( n n − n 1 ) 3 , ℓ n 3 ( ℓ − 1 ) 3 n 1 3 } . \frac{\ell n^3}{\min\{n-n_1,(\ell-1)n_1\}^3}
= \max\left\{\ell\left(\frac{n}{n-n_1}\right)^3,\frac{\ell n^3}{(\ell-1)^3n_1^3}\right\}. min { n − n 1 , ( ℓ − 1 ) n 1 } 3 ℓ n 3 = max { ℓ ( n − n 1 n ) 3 , ( ℓ − 1 ) 3 n 1 3 ℓ n 3 } .
where we used that for positive numbers A , B , C A,B,C A , B , C it holds A / min { B , C } 3 = max { A / B 3 , A / C 3 } A/\min\{B,C\}^3=\max\{A/B^3,A/C^3\} A / min { B , C } 3 = max { A / B 3 , A / C 3 } , since x ↦ x 3 x \mapsto x^3 x ↦ x 3 is increasing. The claim follows by ℓ / ( ℓ − 1 ) 3 = Θ ( ℓ − 2 ) \ell/(\ell-1)^3=\Theta(\ell^{-2}) ℓ / ( ℓ − 1 ) 3 = Θ ( ℓ − 2 ) , concluding the proof. □
First note, that under the hypothesis N ⋆ ≥ ℓ N^{\star} \ge\ell N ⋆ ≥ ℓ , the lower bound of Lemma H.6 yields ∑ h ≤ H ⋆ K ( h ) Φ ( h ) 2 = Θ ( ( N ⋆ ) 3 ) \sum_{h\le H^{\star}} K(h)\Phi(h)^2 = \Theta((N^{\star})^3) ∑ h ≤ H ⋆ K ( h ) Φ ( h ) 2 = Θ (( N ⋆ ) 3 ) . That is, the bound on the complexity of E N P O W E R M C − ϕ + + \mathrm{ENPOWER}_{\mathrm{MC}-\phi++} ENPOWER MC − ϕ ++ is tight, thus the above improvement is not an artifact of our analysis.
Furthermore, the bound from Theorem H.7 is never worse than the bound of Theorem 4.9 , for any vote profile, since N ⋆ ≤ n − n 1 ≤ n N^{\star} \le n-n_1 \le n N ⋆ ≤ n − n 1 ≤ n and thus ( N ⋆ ) 3 + ℓ ( N ⋆ ) 2 ≤ 2 ℓ n 3 (N^{\star})^3+\ell(N^{\star})^2 \le2\ell n^3 ( N ⋆ ) 3 + ℓ ( N ⋆ ) 2 ≤ 2 ℓ n 3 . The improvement is substantial on vote profiles where most classifiers are correct. Consider a data point with N ⋆ ≥ ℓ N^{\star} \ge\ell N ⋆ ≥ ℓ on which a fraction α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) of the classifiers predicts y 1 y_1 y 1 we thus have N ⋆ ≤ ( 1 − α ) n N^{\star} \le(1-\alpha)n N ⋆ ≤ ( 1 − α ) n , and by Corollary H.8 the improvement is Ω ( ℓ / ( 1 − α ) 3 ) \Omega(\ell/(1-\alpha)^3) Ω ( ℓ / ( 1 − α ) 3 ) , i.e., a factor 10 3 ℓ 10^3\ell 1 0 3 ℓ for α = 9 / 10 \alpha=9/10 α = 9/10 .
A fast polynomial multiplication-based algorithm
We observe that for any fixed iteration h ∈ [ 1 , H ⋆ ] h \in[1,H^{\star}] h ∈ [ 1 , H ⋆ ] , E N P O W E R M C − ϕ + + \mathrm{ENPOWER}_{\mathrm{MC}-\phi++} ENPOWER MC − ϕ ++ incurs a total cost of O ( K ( h ) Φ ( h ) 2 ) O(K(h)\Phi(h)^2) O ( K ( h ) Φ ( h ) 2 ) for building the matrix retaining the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) , due to our simple way of performing polynomial multiplication. That is, we process one label at a time and AddClass and RemoveClass respectively multiply and divide the matrix by the bivariate polynomials A j ( h ; u ) + B j ( h ; u ) t A_j(h;u)+B_j(h;u)t A j ( h ; u ) + B j ( h ; u ) t for any j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] . We briefly describe an algorithm attaining O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) log ℓ ) O(K(h)(\Phi(h-1)+1)\log(K(h)(\Phi(h-1)+1))\log\ell) O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ( K ( h ) ( Φ ( h − 1 ) + 1 )) log ℓ ) cost for processing the matrix containing the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) , relying on fast polynomial multiplication. We however note that we do not implement such technique, as fast polynomial multiplication requires to perform the products modulo a set of primes, followed by the use of the Chinese remainder theorem, while we focus on exact arithmetic, similar concerns are known for weighted majority games (see Kakimura and Terai [17 ] ). For our analysis we use the notation M ( s ) M(s) M ( s ) to denote the number of operations used to multiply two univariate polynomials of degrees less than s s s , following the convention of von zur Gathen and Gerhard [43 ] . We recall that it holds M ( s ) = O ( s log s ) M(s)=O(s\log s) M ( s ) = O ( s log s ) over a ring supporting the FFT, or M ( s ) = O ( s log s log log s ) M(s)=O(s\log s\log\log s) M ( s ) = O ( s log s log log s ) over an arbitrary commutative ring [43 Table 8.6] .
The algorithm. Fix h ≥ 1 h \ge1 h ≥ 1 and recall from Lemma C.5 that P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + B j ( h ; u ) t ) P_h(t,u)=\prod_{j=2}^{\ell}(A_j(h;u)+B_j(h;u)t) P h ( t , u ) = ∏ j = 2 ℓ ( A j ( h ; u ) + B j ( h ; u ) t ) , where B j ( h ; u ) = ( n j h ) u h B_j(h;u)=\binom{n_j}{h}u^h B j ( h ; u ) = ( h n j ) u h .
The variable t t t marks a label receiving exactly h h h votes, hence in each factor t t t it appears only in the monomial B j ( h ; u ) t B_j(h;u)t B j ( h ; u ) t , always multiplied by u h u^h u h . A monomial t k u m t^k u^m t k u m of P h ( t , u ) P_h(t,u) P h ( t , u ) therefore collects one factor u h u^h u h from each of the k k k factors contributing t t t , that is, the exponent m m m contains a term k h kh k h which is determined by the exponent k k k of t t t . We can thus remove such a term, and for j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] we let
F j ( t , u ) ≔ A j ( h ; u ) + ( n j h ) t . F_j(t,u) \coloneqq A_j(h;u) + \binom{n_j}{h}t . F j ( t , u ) : = A j ( h ; u ) + ( h n j ) t .
That is P h ( t , u ) = ∏ j = 2 ℓ F j ( u h t , u ) P_h(t,u) = \prod_{j=2}^{\ell} F_j(u^h t,u) P h ( t , u ) = ∏ j = 2 ℓ F j ( u h t , u ) , or equivalently
[ t k u m ] P h ( t , u ) = [ t k u m − k h ] ∏ j = 2 ℓ F j ( t , u ) , for every k ≥ 0 and m ≥ 0 , [t^k u^m]P_h(t,u) = [t^k u^{m-kh}] \prod_{j=2}^{\ell} F_j(t,u), \qquad\text{for every } k \ge0 \text{ and } m \ge0 , [ t k u m ] P h ( t , u ) = [ t k u m − k h ] j = 2 ∏ ℓ F j ( t , u ) , for every k ≥ 0 and m ≥ 0 ,
i.e., by simply substituting u h t u^h t u h t for t t t recovers the removed factors. The algorithm we now describe computes the coefficients of ∏ j = 2 ℓ F j ( t , u ) \prod_{j=2}^{\ell} F_j(t,u) ∏ j = 2 ℓ F j ( t , u ) . The coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) are then recovered by the identity above, that is by the map of the indices moving the coefficient of indices ( k , m ) (k,m) ( k , m ) to the indices ( k , m + k h ) (k,m+kh) ( k , m + k h ) . Using the factors F j ( t , u ) F_j(t,u) F j ( t , u ) allows us to reduce the degree of the generating function in u u u , yielding a faster polynomial multiplication. To simplify our notation, in the remainder of this subsection we let P h ( t , u ) P_h(t,u) P h ( t , u ) denote ∏ j = 2 ℓ F j ( t , u ) \prod_{j=2}^{\ell} F_j(t,u) ∏ j = 2 ℓ F j ( t , u ) , leaving thus the above substitution implicit in the notation.
Bottom-up pass. We can compute the matrix with the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) by divide and conquer as follows
(a) discard every label y j y_j y j , j ≥ 2 j \ge2 j ≥ 2 with n j = 0 n_j = 0 n j = 0 , for which A j ( h ; u ) = 1 A_j(h;u) = 1 A j ( h ; u ) = 1 and ( n j h ) = 0 \binom{n_j}{h} = 0 ( h n j ) = 0 , hence F j ( t , u ) = 1 F_j(t,u) = 1 F j ( t , u ) = 1 , and let ℓ h ≤ ℓ − 1 \ell_h \le\ell- 1 ℓ h ≤ ℓ − 1 be the number of remaining labels;
(b) build a binary tree whose nodes hold sets of labels with n j ≥ 1 n_j \ge1 n j ≥ 1 , j ≥ 2 j \ge2 j ≥ 2 : the root holds the ℓ h \ell_h ℓ h labels with non-zero votes. Any (internal) node holds a set J J J of at least two labels, with its two children holding a balanced partition of J J J of sizes ⌈ ∣ J ∣ / 2 ⌉ \lceil|J|/2\rceil ⌈ ∣ J ∣/2 ⌉ and ⌊ ∣ J ∣ / 2 ⌋ \lfloor|J|/2\rfloor ⌊ ∣ J ∣/2 ⌋ . A leaf holds a single label, therefore the tree has ℓ h \ell_h ℓ h leaves and depth ⌈ log 2 ℓ h ⌉ \lceil\log_2 \ell_h\rceil ⌈ log 2 ℓ h ⌉ , since it is a complete binary tree.
(c) assign to each leaf the factor F j ( t , u ) F_j(t,u) F j ( t , u ) of the single label y j y_j y j it holds, and to each internal node the product of the two polynomials of its children. Thus a node holding a set J v J_v J v holds ∏ j ∈ J v F j ( t , u ) \prod_{j \in J_v} F_j(t,u) ∏ j ∈ J v F j ( t , u ) , and the root node holds P h ( t , u ) P_h(t,u) P h ( t , u ) ;
(d) the polynomial of each node v v v in the tree has degree K v ≔ ∣ { j ∈ J v : n j ≥ h } ∣ K_v \coloneqq|\{j \in J_v : n_j \ge h\}| K v : = ∣ { j ∈ J v : n j ≥ h } ∣ in t t t and degree Φ v ≔ ∑ j ∈ J v min { n j , h − 1 } \Phi_v \coloneqq\sum_{j \in J_v} \min\{n_j,h-1\} Φ v : = ∑ j ∈ J v min { n j , h − 1 } in u u u , since ( n j h ) \binom{n_j}{h} ( h n j ) is zero for n j < h n_j < h n j < h , while the degree in u u u of F j ( t , u ) F_j(t,u) F j ( t , u ) is the degree of A j ( h ; u ) A_j(h;u) A j ( h ; u ) , that is min { n j , h − 1 } \min\{n_j,h-1\} min { n j , h − 1 } , as the coefficient of t t t in F j ( t , u ) F_j(t,u) F j ( t , u ) does not depend on u u u . Therefore, the matrix of coefficients representing ∏ j ∈ J v F j ( t , u ) \prod_{j \in J_v} F_j(t,u) ∏ j ∈ J v F j ( t , u ) of node v v v has ( K v + 1 ) × ( Φ v + 1 ) (K_v+1)\times(\Phi_v+1) ( K v + 1 ) × ( Φ v + 1 ) entries. Note that the root of the tree holds a matrix with ( K ( h ) + 1 ) × ( Φ ( h − 1 ) + 1 ) (K(h)+1)\times(\Phi(h-1)+1) ( K ( h ) + 1 ) × ( Φ ( h − 1 ) + 1 ) entries, in place of the ( K ( h ) + 1 ) × ( Φ ( h ) + 1 ) (K(h)+1)\times(\Phi(h)+1) ( K ( h ) + 1 ) × ( Φ ( h ) + 1 ) entries required to store the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) without our substitution;
(e) for any internal node v v v with children w w w and r r r let P w P_w P w and P r P_r P r represent the two polynomials of the two nodes respectively. To compute ∏ j ∈ J v F j ( t , u ) \prod_{j \in J_v} F_j(t,u) ∏ j ∈ J v F j ( t , u ) from P w , P r P_w,P_r P w , P r apply the Kronecker substitution t = u Φ v + 1 t=u^{\Phi_v+1} t = u Φ v + 1 on both P w , P r P_w,P_r P w , P r , which maps each polynomial to a univariate polynomial in u u u . The image of P w P_w P w has degree K w ( Φ v + 1 ) + Φ w ≤ ( K v + 1 ) ( Φ v + 1 ) − 1 K_w(\Phi_v+1)+\Phi_w \le(K_v+1)(\Phi_v+1)-1 K w ( Φ v + 1 ) + Φ w ≤ ( K v + 1 ) ( Φ v + 1 ) − 1 , since K w ≤ K v K_w \le K_v K w ≤ K v and Φ w ≤ Φ v \Phi_w \le\Phi_v Φ w ≤ Φ v , and analogously for P r P_r P r . The two images can be multiplied with O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) O(\mathsf{M}((K_v+1)(\Phi_v+1))) O ( M (( K v + 1 ) ( Φ v + 1 ))) operations [43 Corollary 8.28] . To recover the coefficients of ∏ j ∈ J v F j ( t , u ) \prod_{j \in J_v} F_j(t,u) ∏ j ∈ J v F j ( t , u ) it is sufficient to split the resulting product of the two images into consecutive blocks of Φ v + 1 \Phi_v+1 Φ v + 1 coefficients, the block of index k ∈ [ 0 , K v ] k \in[0,K_v] k ∈ [ 0 , K v ] corresponds to the coefficients of the term t k t^k t k . Such a splitting inverts the substitution since J v J_v J v is the disjoint union of J w J_w J w and J r J_r J r , hence Φ w + Φ r = Φ v \Phi_w+\Phi_r=\Phi_v Φ w + Φ r = Φ v (see (d) above) and the product ∏ j ∈ J v F j ( t , u ) \prod_{j \in J_v} F_j(t,u) ∏ j ∈ J v F j ( t , u ) has degree at most Φ v \Phi_v Φ v in the variable u u u . The monomials t k u m t^k u^m t k u m with k ∈ [ 0 , K v ] k \in[0,K_v] k ∈ [ 0 , K v ] and m ∈ [ 0 , Φ v ] m \in[0,\Phi_v] m ∈ [ 0 , Φ v ] are therefore mapped to the distinct powers u k ( Φ v + 1 ) + m u^{k(\Phi_v+1)+m} u k ( Φ v + 1 ) + m , avoiding overlap.
It is clear that processing the tree in a bottom-up manner, we recover at the root node the matrix retaining the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) . In turn, this allows us to compute the contribution of index h h h to the Shapley value of a correct classifier, by the first equation of Theorem 4.8 .
To bound the total time complexity of an iteration h ∈ [ 1 , H ∗ ] h \in[1,H^*] h ∈ [ 1 , H ∗ ] of the algorithm we sum the cost of computing the polynomials of the nodes of the tree, one level at a time. Let V L V_L V L be the set of the nodes at level L ∈ [ 0 , ⌈ log 2 ℓ h ⌉ ] L \in[0,\lceil\log_2 \ell_h\rceil] L ∈ [ 0 , ⌈ log 2 ℓ h ⌉] of the tree, and recall from (e) that computing the polynomial of a node v v v requires O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) O(\mathsf{M}((K_v+1)(\Phi_v+1))) O ( M (( K v + 1 ) ( Φ v + 1 ))) operations. The label sets of the nodes of V L V_L V L are pairwise disjoint subsets of the ℓ h \ell_h ℓ h labels, thus ∑ v ∈ V L K v ≤ K ( h ) \sum_{v\in V_L} K_v \le K(h) ∑ v ∈ V L K v ≤ K ( h ) , ∑ v ∈ V L Φ v ≤ Φ ( h − 1 ) \sum_{v\in V_L} \Phi_v \le\Phi(h-1) ∑ v ∈ V L Φ v ≤ Φ ( h − 1 ) , and ∣ V L ∣ ≤ ℓ h |V_L| \le\ell_h ∣ V L ∣ ≤ ℓ h . Therefore
∑ v ∈ V L ( K v + 1 ) ( Φ v + 1 ) ≤ K ( h ) Φ ( h − 1 ) + K ( h ) + Φ ( h − 1 ) + ℓ h = O ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) , (35) \sum_{v\in V_L}(K_v+1)(\Phi_v+1) \le K(h)\Phi(h-1)+K(h)+\Phi(h-1)+\ell_h = O(K(h)(\Phi(h-1)+1)), \tag*{(35)} v ∈ V L ∑ ( K v + 1 ) ( Φ v + 1 ) ≤ K ( h ) Φ ( h − 1 ) + K ( h ) + Φ ( h − 1 ) + ℓ h = O ( K ( h ) ( Φ ( h − 1 ) + 1 )) , (35)
where the first inequality expands the product and uses ∑ v ∈ V L K v Φ v ≤ ( ∑ v ∈ V L K v ) ( ∑ v ∈ V L Φ v ) \sum_{v\in V_L} K_v\Phi_v \le(\sum_{v\in V_L} K_v)(\sum_{v\in V_L} \Phi_v) ∑ v ∈ V L K v Φ v ≤ ( ∑ v ∈ V L K v ) ( ∑ v ∈ V L Φ v ) , which holds since all the terms are non-negative. The last step groups the first two terms as K ( h ) Φ ( h − 1 ) + K ( h ) = K ( h ) ( Φ ( h − 1 ) + 1 ) K(h)\Phi(h-1)+K(h)=K(h)(\Phi(h-1)+1) K ( h ) Φ ( h − 1 ) + K ( h ) = K ( h ) ( Φ ( h − 1 ) + 1 ) , and bounds each of the two remaining terms with K ( h ) ( Φ ( h − 1 ) + 1 ) K(h)(\Phi(h-1)+1) K ( h ) ( Φ ( h − 1 ) + 1 ) . The term Φ ( h − 1 ) \Phi(h-1) Φ ( h − 1 ) is bounded since K ( h ) ≥ 1 K(h)\ge1 K ( h ) ≥ 1 for every h ≤ H ⋆ h\le H^\star h ≤ H ⋆ , while for the term ℓ h \ell_h ℓ h we use ℓ h ≤ K ( h ) ( Φ ( h − 1 ) + 1 ) \ell_h\le K(h)(\Phi(h-1)+1) ℓ h ≤ K ( h ) ( Φ ( h − 1 ) + 1 ) . In fact, for h = 1 h=1 h = 1 we have Φ ( 0 ) = 0 \Phi(0)=0 Φ ( 0 ) = 0 , hence K ( h ) ( Φ ( h − 1 ) + 1 ) = K ( 1 ) = ℓ h K(h)(\Phi(h-1)+1)=K(1)=\ell_h K ( h ) ( Φ ( h − 1 ) + 1 ) = K ( 1 ) = ℓ h , and the bound holds with equality. For h ≥ 2 h\ge2 h ≥ 2 each of the ℓ h \ell_h ℓ h labels has min { n j , h − 1 } ≥ 1 \min\{n_j,h-1\}\ge1 min { n j , h − 1 } ≥ 1 , hence Φ ( h − 1 ) ≥ ℓ h \Phi(h-1)\ge\ell_h Φ ( h − 1 ) ≥ ℓ h , and the bound follows by K ( h ) ≥ 1 K(h)\ge1 K ( h ) ≥ 1 .
The cost of performing the polynomial multiplications on a fixed level is therefore ∑ v ∈ V L O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) = O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) ) \sum_{v\in V_L} O(\mathsf{M}((K_v+1)(\Phi_v+1)))=O(\mathsf{M}(K(h)(\Phi(h-1)+1))) ∑ v ∈ V L O ( M (( K v + 1 ) ( Φ v + 1 ))) = O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 ))) , by the superlinearity M ( s ) + M ( s ′ ) ≤ M ( s + s ′ ) \mathsf{M}(s)+\mathsf{M}(s')\le\mathsf{M}(s+s') M ( s ) + M ( s ′ ) ≤ M ( s + s ′ ) and by M ( c s ) = O ( M ( s ) ) \mathsf{M}(cs)=O(\mathsf{M}(s)) M ( cs ) = O ( M ( s )) for any constant c c c , see von zur Gathen and Gerhard [43, Section 8.3].
The tree has O ( log ℓ ) O(\log\ell) O ( log ℓ ) levels, thus summing the cost of the levels yields a total of O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) log ℓ ) O(\mathsf{M}(K(h)(\Phi(h-1)+1))\log\ell) O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 )) log ℓ ) number of operations. The bound M ( s ) = O ( s log s ) \mathsf{M}(s)=O(s\log s) M ( s ) = O ( s log s ) of the FFT to perform the multiplications over the tree yields a time complexity bounded by O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) log ℓ ) O(K(h)(\Phi(h-1)+1)\log(K(h)(\Phi(h-1)+1))\log\ell) O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ( K ( h ) ( Φ ( h − 1 ) + 1 )) log ℓ ) .
Top-down pass. We now show that the divisions required RemoveClass can be performed without incurring in an additional complexity cost. In particular, for j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] let
Q j = ∏ j ′ = 2 j ′ ≠ j ℓ ( A j ′ ( h ; u ) + B j ′ ( h ; u ) t ) , Q_j=\prod_{\substack{j'=2\\j'\ne j}}^\ell\left(A_{j'}(h;u)+B_{j'}(h;u)t\right), Q j = j ′ = 2 j ′ = j ∏ ℓ ( A j ′ ( h ; u ) + B j ′ ( h ; u ) t ) ,
that is, Q j Q_j Q j is the generating function of Corollary C.6 , obtained by removing the factor of y j y_j y j from the polynomial of Lemma C.5. Note that Q j Q_j Q j is a product of the factors of Lemma C.5, and not of the factors F j ( t , u ) F_j(t,u) F j ( t , u ) used by the tree. We will show that we do not require to compute explicitly the matrices Q j Q_j Q j , and we can recover their contribution from our tree constructed above. For a fixed h ∈ [ 1 , H ⋆ ] h\in[1,H^\star] h ∈ [ 1 , H ⋆ ] we can express
f j ( k , h , m ) = ( n j h ) [ ( n j − 1 h ) w 1 ( k , m ) + ( n j − 1 h − 1 ) w 2 ( k , m ) ] , f_j(k,h,m)=\binom{n_j}{h}\left[\binom{n_j-1}{h}w_1(k,m)+\binom{n_j-1}{h-1}w_2(k,m)\right], f j ( k , h , m ) = ( h n j ) [ ( h n j − 1 ) w 1 ( k , m ) + ( h − 1 n j − 1 ) w 2 ( k , m ) ] ,
w 1 ( k , m ) = η ( m + 2 h + 1 ) k + 2 , and w 2 ( k , m ) = η ( m + 2 h ) ( k + 1 ) ( k + 2 ) . w_1(k,m)=\frac{\eta(m+2h+1)}{k+2},\qquad\text{and}\qquad w_2(k,m)=\frac{\eta(m+2h)}{(k+1)(k+2)}. w 1 ( k , m ) = k + 2 η ( m + 2 h + 1 ) , and w 2 ( k , m ) = ( k + 1 ) ( k + 2 ) η ( m + 2 h ) .
Note that the dependency of f j f_j f j on the label y j y_j y j is limited to the two binomial coefficients, while w 1 w_1 w 1 and w 2 w_2 w 2 are common to all the labels j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] . We extend η ( ⋅ ) \eta(\cdot) η ( ⋅ ) by η ( a ) : = 0 \eta(a)\mathrel{:=}0 η ( a ) := 0 for a > n a>n a > n , thus w 1 ( k , m ) w_1(k,m) w 1 ( k , m ) and w 2 ( k , m ) w_2(k,m) w 2 ( k , m ) can be evaluated for every k ≥ 0 k\ge0 k ≥ 0 and m ≥ 0 m\ge0 m ≥ 0 . Fix i ∈ { 1 , 2 } i\in\{1,2\} i ∈ { 1 , 2 } , for a polynomial G ( t , u ) G(t,u) G ( t , u ) we let
Λ ( G , w i ) : = ∑ k ≥ 0 ∑ m ≥ 0 w i ( k , m ) [ t k u m ] G . \Lambda(G,w_i):=\sum_{k\ge0}\sum_{m\ge0}w_i(k,m)[t^ku^m]G. Λ ( G , w i ) := k ≥ 0 ∑ m ≥ 0 ∑ w i ( k , m ) [ t k u m ] G .
The two sums have finitely many non-zero terms, since G G G has finitely many non-zero coefficients, and w i ( k , m ) w_i(k,m) w i ( k , m ) is defined for every k ≥ 0 k\ge0 k ≥ 0 and m ≥ 0 m\ge0 m ≥ 0 by our extension of η ( ⋅ ) \eta(\cdot) η ( ⋅ ) , hence Λ ( ⋅ , w i ) \Lambda(\cdot,w_i) Λ ( ⋅ , w i ) is a linear functional on the polynomials in t t t and u u u . Furthermore, for j ∈ [ 2 , ℓ ] j\in[2,\ell] j ∈ [ 2 , ℓ ] and h ≥ 1 h\ge1 h ≥ 1 we let
S h ( j ) : = ∑ k = 0 ℓ − 2 ∑ m = h k n − ( n 1 + n j ) f j ( k , h , m ) [ t k u m ] Q j , S_h(j):=\sum_{k=0}^{\ell-2}\sum_{m=hk}^{n-(n_1+n_j)}f_j(k,h,m)[t^ku^m]Q_j, S h ( j ) := k = 0 ∑ ℓ − 2 m = hk ∑ n − ( n 1 + n j ) f j ( k , h , m ) [ t k u m ] Q j ,
that is S h ( j ) S_h(j) S h ( j ) is the summand of index h h h of the second equation of Theorem 4.8 , i.e., a classifier predicting the incorrect label y j y_j y j has Shapley value = ∑ h = 1 n j S h ( j ) =\sum_{h=1}^{n_j}S_h(j) = ∑ h = 1 n j S h ( j ) over G z G_z G z . The next lemma shows that S h ( j ) S_h(j) S h ( j ) is determined by the two values Λ ( Q j , w 1 ) \Lambda(Q_j,w_1) Λ ( Q j , w 1 ) and Λ ( Q j , w 2 ) \Lambda(Q_j,w_2) Λ ( Q j , w 2 ) , that is by two linear functionals of Q j Q_j Q j . Hence, to evaluate S h ( j ) S_h(j) S h ( j ) we do not need to process the ( K − j ( h ) + 1 ) ( Φ ( h − 1 ) − min { n j , h − 1 } + 1 ) (K_{-j}(h)+1)(\Phi(h-1)-\min\{n_j,h-1\}+1) ( K − j ( h ) + 1 ) ( Φ ( h − 1 ) − min { n j , h − 1 } + 1 ) entries of the matrix representing Q j Q_j Q j after the map of the indices.
Lemma H.9. Fix j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] and h ≥ 1 h \ge1 h ≥ 1 . The two sums defining Λ ( Q j , w i ) \Lambda(Q_j,w_i) Λ ( Q j , w i ) , i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } , have finitely many non-zero terms, and
S h ( j ) = ( n 1 h ) [ ( n j − 1 h ) Λ ( Q j , w 1 ) + ( n j − 1 h − 1 ) Λ ( Q j , w 2 ) ] . S_h(j)=\binom{n_1}{h}\left[\binom{n_j-1}{h}\Lambda(Q_j,w_1)+\binom{n_j-1}{h-1}\Lambda(Q_j,w_2)\right]. S h ( j ) = ( h n 1 ) [ ( h n j − 1 ) Λ ( Q j , w 1 ) + ( h − 1 n j − 1 ) Λ ( Q j , w 2 ) ] . Proof. By Lemma H.5 (v) and Lemma H.2 (ii), a pair of indices ( k , m ) (k,m) ( k , m ) for which [ t k u m ] Q j ≠ 0 [t^ku^m]Q_j \ne0 [ t k u m ] Q j = 0 must satisfy
k ≤ K − j ( h ) ≤ ℓ − 2 and h k ≤ m ≤ Φ ( h ) − min { n j , h } ≤ n − ( n 1 + n j ) , (36) k \le K_{-j}(h) \le\ell-2 \qquad\text{and}\qquad hk \le m \le\Phi(h)-\min\{n_j,h\} \le n-(n_1+n_j), \tag*{(36)} k ≤ K − j ( h ) ≤ ℓ − 2 and hk ≤ m ≤ Φ ( h ) − min { n j , h } ≤ n − ( n 1 + n j ) , (36) where the bound on k k k and the bound m ≤ Φ ( h ) − min { n j , h } m \le\Phi(h)-\min\{n_j,h\} m ≤ Φ ( h ) − min { n j , h } follow by Lemma H.5 (v). Furthermore, K − j ( h ) ≤ ℓ − 2 K_{-j}(h) \le\ell-2 K − j ( h ) ≤ ℓ − 2 since K − j ( h ) K_{-j}(h) K − j ( h ) counts the incorrect labels other than y j y_j y j receiving at least h h h votes, which are at most ℓ − 2 \ell-2 ℓ − 2 , thus by the fact that k ≤ ℓ − 2 k \le\ell-2 k ≤ ℓ − 2 and from Lemma H.2 (ii) it must be that m ≥ h k m \ge hk m ≥ hk . The last inequality holds since
Φ ( h ) − min { n j , h } = ∑ j ′ ∈ [ 2 , ℓ ] , j ′ ≠ j min { n j ′ , h } ≤ ∑ j ′ ∈ [ 2 , ℓ ] , j ′ ≠ j n j ′ = N − n j . \Phi(h)-\min\{n_j,h\}=\sum_{\substack{j' \in[2,\ell],j'\ne j}}\min\{n_{j'},h\}\le\sum_{\substack{j' \in[2,\ell],j'\ne j}}n_{j'}=N-n_j. Φ ( h ) − min { n j , h } = j ′ ∈ [ 2 , ℓ ] , j ′ = j ∑ min { n j ′ , h } ≤ j ′ ∈ [ 2 , ℓ ] , j ′ = j ∑ n j ′ = N − n j . Hence Q j Q_j Q j has finitely many non-zero coefficients, and this holds also for the two sums defining Λ ( Q j , w i ) \Lambda(Q_j,w_i) Λ ( Q j , w i ) , which sum over the non-zero coefficients of Q j Q_j Q j . Note that our extension of n n n does not modify any non-zero term. That is, consider a pair ( k , m ) (k,m) ( k , m ) of indices with ( n 1 h ) ( n j − 1 h − 1 ) [ t k u m ] Q j ≠ 0 \binom{n_1}{h}\binom{n_j-1}{h-1}[t^ku^m]Q_j \ne0 ( h n 1 ) ( h − 1 n j − 1 ) [ t k u m ] Q j = 0 , it must be that h ≤ n 1 h \le n_1 h ≤ n 1 , h ≤ n j − 1 h \le n_j-1 h ≤ n j − 1 and m ≤ n − ( n 1 + n j ) m \le n-(n_1+n_j) m ≤ n − ( n 1 + n j ) by Eq. (36) , hence m + 2 h + 1 ≤ n m+2h+1 \le n m + 2 h + 1 ≤ n , and analogously m + 2 h ≤ n m+2h \le n m + 2 h ≤ n when ( n 1 h ) ( n j − 1 h − 1 ) [ t k u m ] Q j ≠ 0 \binom{n_1}{h}\binom{n_j-1}{h-1}[t^ku^m]Q_j \ne0 ( h n 1 ) ( h − 1 n j − 1 ) [ t k u m ] Q j = 0 .
By the definition of f j f_j f j and by linearity,
S h ( j ) = ( n 1 h ) [ ( n j − 1 h ) T 1 + ( n j − 1 h − 1 ) T 2 ] , T i = ∑ k = 0 ℓ − 2 ∑ m = h k n − ( n 1 + n j ) w i ( k , m ) [ t k u m ] Q j . S_h(j)=\binom{n_1}{h}\left[\binom{n_j-1}{h}T_1+\binom{n_j-1}{h-1}T_2\right],\qquad T_i=\sum_{k=0}^{\ell-2}\sum_{m=hk}^{n-(n_1+n_j)}w_i(k,m)[t^ku^m]Q_j. S h ( j ) = ( h n 1 ) [ ( h n j − 1 ) T 1 + ( h − 1 n j − 1 ) T 2 ] , T i = k = 0 ∑ ℓ − 2 m = hk ∑ n − ( n 1 + n j ) w i ( k , m ) [ t k u m ] Q j . In the definition of Λ ( Q j , w i ) \Lambda(Q_j,w_i) Λ ( Q j , w i ) , each pair ( k , m ) (k,m) ( k , m ) of indices outside the ranges defining T i T_i T i yields [ t k u m ] Q j = 0 [t^ku^m]Q_j=0 [ t k u m ] Q j = 0 by Eq. (36) , thus contributing a zero term to Λ ( Q j , w i ) \Lambda(Q_j,w_i) Λ ( Q j , w i ) . Therefore it holds T i = Λ ( Q j , w i ) T_i=\Lambda(Q_j,w_i) T i = Λ ( Q j , w i ) for i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } , which concludes the proof. □ \square □
By Lemma H.9 and Theorem 4.8 , at a fixed iteration h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] the contribution S h ( j ) S_h(j) S h ( j ) of every classifier predicting an incorrect label is determined by the 2 ( ℓ − 1 ) 2(\ell-1) 2 ( ℓ − 1 ) values Λ ( Q j , w i ) \Lambda(Q_j,w_i) Λ ( Q j , w i ) , for j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] and i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } . 14 We now briefly discuss how to obtain the values Λ ( Q j , w i ) \Lambda(Q_j,w_i) Λ ( Q j , w i ) , by a top-down pass on the product tree built for computing the coefficients of P h ( t , u ) P_h(t,u) P h ( t , u ) , avoiding the explicit computation of Q j Q_j Q j , j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] , which would defeat our improvement in the time complexity.
For a node v v v of the tree, with labels J v J_v J v , let P v = ∏ j ∈ J v F j ( t , u ) P_v=\prod_{j\in J_v}F_j(t,u) P v = ∏ j ∈ J v F j ( t , u ) be its polynomial, and let R v = ∏ j ∉ J v F j ( t , u ) R_v=\prod_{j\notin J_v}F_j(t,u) R v = ∏ j ∈ / J v F j ( t , u ) be the product of the factors outside its subtree. Thus, R v ( u h t , u ) = Q j R_v(u^ht,u)=Q_j R v ( u h t , u ) = Q j for any leaf node v v v holding label y j y_j y j , by the map of the indices of the factors F j ( t , u ) F_j(t,u) F j ( t , u ) . In addition, it is simple to observe that R w = R v P r R_w=R_vP_r R w = R v P r for the two children w w w and r r r of an internal node v v v . We now fix i ∈ { 1 , 2 } i\in\{1,2\} i ∈ { 1 , 2 } for the rest of our discussion, our argument will apply for each such value independently. To account for the map of the indices we let w ^ i ( k , m ) = w i ( k , m + h k ) \widehat{w}_i(k,m)=w_i(k,m+hk) w i ( k , m ) = w i ( k , m + hk ) , which is clearly defined for every k ≥ 0 k\ge0 k ≥ 0 and m ≥ 0 m\ge0 m ≥ 0 by our extension of n n n . Substituting m = m ′ + h k m=m'+hk m = m ′ + hk in the definition of Λ ( ⋅ , w i ) \Lambda(\cdot,w_i) Λ ( ⋅ , w i ) yields Λ ( R v , w ^ i ) = Λ ( Q j , w i ) \Lambda(R_v,\widehat{w}_i)=\Lambda(Q_j,w_i) Λ ( R v , w i ) = Λ ( Q j , w i ) for any leaf node v v v holding y j y_j y j . For each node v v v consider the linear functional Λ v ( X ) = Λ ( X R v , w ^ i ) \Lambda_v(X)=\Lambda(XR_v,\widehat{w}_i) Λ v ( X ) = Λ ( X R v , w i ) , where the argument X X X corresponds to a polynomial of degree at most K v K_v K v in t t t and at most Φ v \Phi_v Φ v in u u u , that is X X X ranges over the polynomials with the degrees of P v P_v P v . Note that R v R_v R v has degree K ( h ) − K v K(h)-K_v K ( h ) − K v in t t t and Φ ( h − 1 ) − Φ v \Phi(h-1)-\Phi_v Φ ( h − 1 ) − Φ v in u u u , since each factor F j ( t , u ) F_j(t,u) F j ( t , u ) , j ∉ J v j\notin J_v j ∈ / J v defining R v R_v R v has non-negative coefficients, thus their product sums the degrees of all factors, summing up to K ( h ) − K v K(h)-K_v K ( h ) − K v and Φ ( h − 1 ) − Φ v \Phi(h-1)-\Phi_v Φ ( h − 1 ) − Φ v by (d) and Def. H.1 . Hence the product X R v XR_v X R v has degree at most K ( h ) K(h) K ( h ) and at most Φ ( h − 1 ) \Phi(h-1) Φ ( h − 1 ) in u u u , that is the degrees of P h ( t , u ) P_h(t,u) P h ( t , u ) . In particular, since P v R v = P h ( t , u ) P_vR_v=P_h(t,u) P v R v = P h ( t , u ) for any node v v v in the tree we have Λ v ( P v ) = Λ ( P h , w ^ i ) \Lambda_v(P_v)=\Lambda(P_h,\widehat{w}_i) Λ v ( P v ) = Λ ( P h , w i ) . Any polynomial X X X of the domain of Λ v \Lambda_v Λ v is the sum of its monomials t k u m t^ku^m t k u m weighted by the coefficients X [ k , m ] X[k,m] X [ k , m ] , hence by linearity
Λ v ( X ) = ∑ k = 0 K v ∑ m = 0 Φ v X [ k , m ] Λ v ( t k u m ) , \Lambda_v(X)=\sum_{k=0}^{K_v}\sum_{m=0}^{\Phi_v}X[k,m]\Lambda_v(t^ku^m), Λ v ( X ) = k = 0 ∑ K v m = 0 ∑ Φ v X [ k , m ] Λ v ( t k u m ) ,
that is Λ v \Lambda_v Λ v is determined by its ( K v + 1 ) ( Φ v + 1 ) (K_v + 1)(\Phi_v + 1) ( K v + 1 ) ( Φ v + 1 ) values on the monomials. We represent such values with a matrix of dimension ( K v + 1 ) × ( Φ v + 1 ) (K_v + 1) \times(\Phi_v + 1) ( K v + 1 ) × ( Φ v + 1 ) , and we use Λ v [ k , m ] ≔ Λ v ( t k u m ) \Lambda_v[k,m] \coloneqq\Lambda_v(t^k u^m) Λ v [ k , m ] : = Λ v ( t k u m ) to denote the entries retained in such a matrix. The next lemma shows two important properties exploited by our algorithm, used to evaluate the linear functionals Λ v \Lambda_v Λ v .
Lemma H.10. Fix i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } , h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] and a node v v v of the tree, and let R v [ k ′ , m ′ ] ≔ [ t k ′ u m ′ ] R v R_v[k',m'] \coloneqq[t^{k'}u^{m'}]R_v R v [ k ′ , m ′ ] : = [ t k ′ u m ′ ] R v , with the convention R v [ k ′ , m ′ ] = 0 R_v[k',m'] = 0 R v [ k ′ , m ′ ] = 0 whenever k ′ < 0 k' < 0 k ′ < 0 or m ′ < 0 m' < 0 m ′ < 0 . For every k ∈ [ 0 , K v ] k \in[0,K_v] k ∈ [ 0 , K v ] and m ∈ [ 0 , Φ v ] m \in[0,\Phi_v] m ∈ [ 0 , Φ v ] we have
(i)
Λ v [ k , m ] = ∑ k ′ ≥ 0 ∑ m ′ ≥ 0 w ^ i ( k + k ′ , m + m ′ ) R v [ k ′ , m ′ ] , \Lambda_v[k,m] = \sum_{k'\geq0}\sum_{m'\geq0} \widehat{w}_i(k+k',m+m')R_v[k',m'], Λ v [ k , m ] = k ′ ≥ 0 ∑ m ′ ≥ 0 ∑ w i ( k + k ′ , m + m ′ ) R v [ k ′ , m ′ ] , where the sums have finitely many non-zero terms.
(ii) For every polynomial G ( t , u ) G(t,u) G ( t , u ) of degree at most K v − k K_v-k K v − k in t t t and at most Φ v − m \Phi_v-m Φ v − m in u u u it holds
Λ v ( t k u m G ) = ∑ k ′ ≥ 0 ∑ m ′ ≥ 0 G [ k ′ , m ′ ] Λ v [ k + k ′ , m + m ′ ] . \Lambda_v(t^k u^mG) = \sum_{k'\geq0}\sum_{m'\geq0}G[k',m']\Lambda_v[k+k',m+m']. Λ v ( t k u m G ) = k ′ ≥ 0 ∑ m ′ ≥ 0 ∑ G [ k ′ , m ′ ] Λ v [ k + k ′ , m + m ′ ] .
Proof. (i) The multiplication by the monomial t k u m t^k u^m t k u m shifts the coefficients of R v R_v R v by k k k and m m m , that is [ t a u b ] ( t k u m R v ) = R v [ a − k , b − m ] [t^a u^b](t^k u^mR_v) = R_v[a-k,b-m] [ t a u b ] ( t k u m R v ) = R v [ a − k , b − m ] for every a ≥ 0 a \geq0 a ≥ 0 and $b \geq 0. By the definitions of Λ v \Lambda_v Λ v and of Λ \Lambda Λ we thus have
Λ v [ k , m ] = Λ ( t k u m R v , w ^ i ) = ∑ a ≥ 0 ∑ b ≥ 0 w ^ i ( a , b ) R v [ a − k , b − m ] , \Lambda_v[k,m] = \Lambda(t^k u^mR_v,\widehat{w}_i) = \sum_{a\geq0}\sum_{b\geq0}\widehat{w}_i(a,b)R_v[a-k,b-m], Λ v [ k , m ] = Λ ( t k u m R v , w i ) = a ≥ 0 ∑ b ≥ 0 ∑ w i ( a , b ) R v [ a − k , b − m ] ,
and the claim follows by the substitutions a = k + k ′ a = k+k' a = k + k ′ and b = m + m ′ b = m+m' b = m + m ′ , noting that the terms with a < k a < k a < k or b < m b < m b < m are zero by definition. It is simple to note that the sum has finitely many non-zero terms since R v R_v R v is a polynomial, and w ^ i ( a , b ) \widehat{w}_i(a,b) w i ( a , b ) is defined for every a ≥ 0 a \geq0 a ≥ 0 and b ≥ 0 b \geq0 b ≥ 0 by our extension of η ( ⋅ ) \eta(\cdot) η ( ⋅ ) .
(ii) Expanding G G G over its monomials and multiplying by t k u m t^k u^m t k u m yields t k u m G = ∑ k ′ ≥ 0 ∑ m ′ ≥ 0 G [ k ′ , m ′ ] t k + k ′ u m + m ′ t^k u^mG = \sum_{k'\geq0}\sum_{m'\geq0}G[k',m']t^{k+k'}u^{m+m'} t k u m G = ∑ k ′ ≥ 0 ∑ m ′ ≥ 0 G [ k ′ , m ′ ] t k + k ′ u m + m ′ . Each of its monomials lies in the domain of Λ v \Lambda_v Λ v , since k + k ′ ≤ K v k+k' \leq K_v k + k ′ ≤ K v and m + m ′ ≤ Φ v m+m' \leq\Phi_v m + m ′ ≤ Φ v by the assumption on the degrees of G G G , and on the values of k k k and m m m , thus t k u m G t^k u^mG t k u m G is in the domain of Λ v \Lambda_v Λ v . The claim follows by the linearity of Λ v \Lambda_v Λ v and by Λ v [ k + k ′ , m + m ′ ] = Λ v ( t k + k ′ u m + m ′ ) \Lambda_v[k+k',m+m'] = \Lambda_v(t^{k+k'}u^{m+m'}) Λ v [ k + k ′ , m + m ′ ] = Λ v ( t k + k ′ u m + m ′ ) .
We are now ready to detail our top-down algorithm, fix i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } and proceed as follows
(i) the root v v v has J v = [ 2 , ℓ ] J_v = [2,\ell] J v = [ 2 , ℓ ] and R v = 1 R_v = 1 R v = 1 , hence Λ v ( X ) = Λ ( X , w ^ i ) \Lambda_v(X) = \Lambda(X,\widehat{w}_i) Λ v ( X ) = Λ ( X , w i ) and Λ v [ k , m ] = w ^ i ( k , m ) \Lambda_v[k,m] = \widehat{w}_i(k,m) Λ v [ k , m ] = w i ( k , m ) for k ∈ [ 0 , K ( h ) ] k \in[0,K(h)] k ∈ [ 0 , K ( h )] and m ∈ [ 0 , Φ ( h − 1 ) ] m \in[0,\Phi(h-1)] m ∈ [ 0 , Φ ( h − 1 )] ;
(ii) at an internal node v v v with children w w w and r r r we have R w = R v P r R_w = R_vP_r R w = R v P r . Thus Λ w ( X ) = Λ ( X P r R v , w ^ i ) = Λ v ( X P r ) \Lambda_w(X) = \Lambda(XP_rR_v,\widehat{w}_i) = \Lambda_v(XP_r) Λ w ( X ) = Λ ( X P r R v , w i ) = Λ v ( X P r ) , by evaluating X = t k u m X = t^k u^m X = t k u m it holds
Λ w [ k , m ] = Λ v ( t k u m P r ) = ∑ k ′ = 0 K r ∑ m ′ = 0 Φ r P r [ k ′ , m ′ ] Λ v [ k + k ′ , m + m ′ ] , (37) \Lambda_w[k,m] = \Lambda_v(t^k u^mP_r) = \sum_{k'=0}^{K_r}\sum_{m'=0}^{\Phi_r}P_r[k',m']\Lambda_v[k+k',m+m'], \tag*{(37)} Λ w [ k , m ] = Λ v ( t k u m P r ) = k ′ = 0 ∑ K r m ′ = 0 ∑ Φ r P r [ k ′ , m ′ ] Λ v [ k + k ′ , m + m ′ ] , (37)
for k ∈ [ 0 , K w ] k \in[0,K_w] k ∈ [ 0 , K w ] and m ∈ [ 0 , Φ w ] m \in[0,\Phi_w] m ∈ [ 0 , Φ w ] , where we used Lemma H.10 (ii) with G = P r G = P_r G = P r , note that the degrees satisfy the bounds of the lemma, since K w + K r = K v K_w + K_r = K_v K w + K r = K v and Φ w + Φ r = Φ v \Phi_w + \Phi_r = \Phi_v Φ w + Φ r = Φ v , i.e., K r ≤ K v − k K_r \leq K_v-k K r ≤ K v − k and Φ r ≤ Φ v − m \Phi_r \leq\Phi_v-m Φ r ≤ Φ v − m . That is, we can obtain Λ w \Lambda_w Λ w from the entries of P r P_r P r (computed in the bottom-up processing of the tree) and from the entries of Λ v \Lambda_v Λ v (already available since we are processing the tree top-down). The matrix Λ r \Lambda_r Λ r is obtained analogously from Λ v \Lambda_v Λ v and P w P_w P w . Note that we do not have to compute Eq. (37) by evaluating each entry independently. Such an evaluation would require ( K w + 1 ) ( Φ w + 1 ) ( K r + 1 ) ( Φ r + 1 ) (K_w+1)(\Phi_w+1)(K_r+1)(\Phi_r+1) ( K w + 1 ) ( Φ w + 1 ) ( K r + 1 ) ( Φ r + 1 ) operations, which is up to quadratic in the size of the matrix of P v P_v P v , defeating our purpose. We show in Lemma H.11 how to obtain the entries of the matrix of Λ w \Lambda_w Λ w by a single polynomial multiplication of two bivariate polynomials. The first polynomial has the entries of the matrix of Λ v \Lambda_v Λ v as its coefficients, and the second one is P r P_r P r with its indices reversed. Computing both Λ w \Lambda_w Λ w and Λ r \Lambda_r Λ r is thus reduced to O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) O(M((K_v+1)(\Phi_v+1))) O ( M (( K v + 1 ) ( Φ v + 1 ))) total operations, that is the cost incurred at the node v v v to build P v P_v P v in the bottom-up phase; (iii) read Λ v [ 0 , 0 ] \Lambda_v[0,0] Λ v [ 0 , 0 ] for any leaf v v v , that is, for a leaf v v v holding the label y j y_j y j it holds R v ( u t , u ) = Q j R_v(u^t,u)=Q_j R v ( u t , u ) = Q j , hence Λ v [ 0 , 0 ] = Λ v ( 1 ) = Λ ( R v , w ^ i ) = Λ ( Q j , w i ) \Lambda_v[0,0]=\Lambda_v(1)=\Lambda(R_v,\widehat{w}_i)=\Lambda(Q_j,w_i) Λ v [ 0 , 0 ] = Λ v ( 1 ) = Λ ( R v , w i ) = Λ ( Q j , w i ) . Finally, use such values to compute S h ( j ) S_h(j) S h ( j ) by Lemma H.9 .
The next lemma shows that the matrix Λ w \Lambda_w Λ w (obtained in step (ii) above) can be computed from matrices Λ v \Lambda_v Λ v and from the matrix of P r P_r P r with its two indices reversed.15
Lemma H.11. Fix i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } , h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] , and an internal node v v v of the tree with children w w w and r r r . Let C ( t , u ) C(t,u) C ( t , u ) be the product of the two bivariate polynomials
∑ k = 0 K r ∑ m = 0 Φ r P r [ K r − k , Φ r − m ] t k u m , ∑ k = 0 K v ∑ m = 0 Φ v Λ v [ k , m ] t k u m , \sum_{k=0}^{K_r}\sum_{m=0}^{\Phi_r} P_r[K_r-k,\Phi_r-m]t^k u^m,\qquad\sum_{k=0}^{K_v}\sum_{m=0}^{\Phi_v}\Lambda_v[k,m]t^k u^m, k = 0 ∑ K r m = 0 ∑ Φ r P r [ K r − k , Φ r − m ] t k u m , k = 0 ∑ K v m = 0 ∑ Φ v Λ v [ k , m ] t k u m , that is, the first polynomial has at its coefficients the entries of P r P_r P r reversed,16 and the second polynomial holds the matrix of Λ v \Lambda_v Λ v as its coefficients. Then the following hold.
(i) Λ w [ k , m ] = [ t k + K r u m + Φ r ] C ( t , u ) \Lambda_w[k,m]=[t^{k+K_r}u^{m+\Phi_r}]C(t,u) Λ w [ k , m ] = [ t k + K r u m + Φ r ] C ( t , u ) for every k ∈ [ 0 , K w ] k \in[0,K_w] k ∈ [ 0 , K w ] and m ∈ [ 0 , Φ w ] m \in[0,\Phi_w] m ∈ [ 0 , Φ w ] ; and
(ii) the matrix of Λ w \Lambda_w Λ w is obtained from the matrices of Λ v \Lambda_v Λ v and of P r P_r P r with O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) O(\mathsf{M}((K_v+1)(\Phi_v+1))) O ( M (( K v + 1 ) ( Φ v + 1 ))) total operations.
Proof. (i) We adopt the convention Λ v [ k , m ] = 0 \Lambda_v[k,m]=0 Λ v [ k , m ] = 0 whenever k < 0 k<0 k < 0 , m < 0 m<0 m < 0 , k > K v k>K_v k > K v or m > Φ v m>\Phi_v m > Φ v . For every a ≥ 0 a \ge0 a ≥ 0 and b ≥ 0 b \ge0 b ≥ 0 it holds
[ t a u b ] C ( t , u ) = ∑ k ′ = 0 K r ∑ m ′ = 0 Φ r P r [ K r − k ′ , Φ r − m ′ ] Λ v [ a − k ′ , b − m ′ ] , [t^a u^b]C(t,u)=\sum_{k'=0}^{K_r}\sum_{m'=0}^{\Phi_r}P_r[K_r-k',\Phi_r-m']\Lambda_v[a-k',b-m'], [ t a u b ] C ( t , u ) = k ′ = 0 ∑ K r m ′ = 0 ∑ Φ r P r [ K r − k ′ , Φ r − m ′ ] Λ v [ a − k ′ , b − m ′ ] ,
by the definition of polynomial multiplication and by our convention on Λ v \Lambda_v Λ v , since the first factor of C ( t , u ) C(t,u) C ( t , u ) has degree K r K_r K r in t t t and Φ r \Phi_r Φ r in u u u . Thus
[ t a u b ] C ( t , u ) = ∑ k ′ ′ = 0 K r ∑ m ′ ′ = 0 Φ r P r [ k ′ ′ , m ′ ′ ] Λ v [ a − K r + k ′ ′ , b − Φ r + m ′ ′ ] , [t^a u^b]C(t,u)=\sum_{k''=0}^{K_r}\sum_{m''=0}^{\Phi_r}P_r[k'',m'']\Lambda_v[a-K_r+k'',b-\Phi_r+m''], [ t a u b ] C ( t , u ) = k ′′ = 0 ∑ K r m ′′ = 0 ∑ Φ r P r [ k ′′ , m ′′ ] Λ v [ a − K r + k ′′ , b − Φ r + m ′′ ] ,
by substituting k ′ ′ = K r − k ′ k''=K_r-k' k ′′ = K r − k ′ and m ′ ′ = Φ r − m ′ m''=\Phi_r-m' m ′′ = Φ r − m ′ . Fix k ∈ [ 0 , K w ] k \in[0,K_w] k ∈ [ 0 , K w ] and m ∈ [ 0 , Φ w ] m \in[0,\Phi_w] m ∈ [ 0 , Φ w ] , and consider the identity above for a = k + K r a=k+K_r a = k + K r and b = m + Φ r b=m+\Phi_r b = m + Φ r . Each entry of Λ v \Lambda_v Λ v in the sum has therefore indices k + k ′ ′ k+k'' k + k ′′ and m + m ′ ′ m+m'' m + m ′′ , with 0 ≤ k + k ′ ′ ≤ K w + K r = K v 0 \le k+k'' \le K_w+K_r=K_v 0 ≤ k + k ′′ ≤ K w + K r = K v and 0 ≤ m + m ′ ′ ≤ Φ w + Φ r = Φ v 0 \le m+m'' \le\Phi_w+\Phi_r=\Phi_v 0 ≤ m + m ′′ ≤ Φ w + Φ r = Φ v , thus the indices do not range over the zero entries set by our convention. The resulting sum coincides with right-hand side of Eq. (37) , which equals Λ w [ k , m ] \Lambda_w[k,m] Λ w [ k , m ] and proves the first part of the claim.
(ii) We multiply the two bivariate polynomials defining C ( t , u ) C(t,u) C ( t , u ) similarly to how we obtain P v P_v P v at an internal node v v v of the tree in the bottom-up phase, that is, by the Kronecker substitution and the FFT. First we apply the Kronecker substitution t = u Φ r + Φ v + 1 t=u^{\Phi_r+\Phi_v+1} t = u Φ r + Φ v + 1 to the two factors of C ( t , u ) C(t,u) C ( t , u ) , as in step (e) of the bottom-up algorithm. Note that the polynomial C ( t , u ) C(t,u) C ( t , u ) has degree at most K r + K v K_r+K_v K r + K v in t t t and at most Φ r + Φ v \Phi_r+\Phi_v Φ r + Φ v in u u u , hence the substitution maps the monomials t a u b t^a u^b t a u b with a ∈ [ 0 , K r + K v ] a \in[0,K_r+K_v] a ∈ [ 0 , K r + K v ] and b ∈ [ 0 , Φ r + Φ v ] b \in[0,\Phi_r+\Phi_v] b ∈ [ 0 , Φ r + Φ v ] to distinct powers of u u u . To recover the coefficients of C ( t , u ) C(t,u) C ( t , u ) , we split the coefficients of the product of the two images (i.e., FFT’s output) into consecutive blocks of Φ r + Φ v + 1 \Phi_r+\Phi_v+1 Φ r + Φ v + 1 coefficients.17 The image of the second factor of C ( t , u ) C(t,u) C ( t , u ) has degree K v ( Φ r + Φ v + 1 ) + Φ v ≤ ( K v + 1 ) ( 2 Φ v + 1 ) − 1 K_v(\Phi_r+\Phi_v+1)+\Phi_v \le(K_v+1)(2\Phi_v+1)-1 K v ( Φ r + Φ v + 1 ) + Φ v ≤ ( K v + 1 ) ( 2 Φ v + 1 ) − 1 , since Φ r ≤ Φ v \Phi_r \le\Phi_v Φ r ≤ Φ v , and the image of the first factor has a smaller degree, since K r ≤ K v K_r \le K_v K r ≤ K v and Φ r ≤ Φ v \Phi_r \le\Phi_v Φ r ≤ Φ v . The two images are therefore multiplied with O ( M ( ( K v + 1 ) ( 2 Φ v + 1 ) ) ) = O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) O(\mathsf{M}((K_v+1)(2\Phi_v+1)))=O(\mathsf{M}((K_v+1)(\Phi_v+1))) O ( M (( K v + 1 ) ( 2 Φ v + 1 ))) = O ( M (( K v + 1 ) ( Φ v + 1 ))) operations by von zur Gathen and Gerhard [43 Corollary 8.28] , since ( K v + 1 ) ( 2 Φ v + 1 ) ≤ 2 ( K v + 1 ) ( Φ v + 1 ) (K_v+1)(2\Phi_v+1)\le2(K_v+1)(\Phi_v+1) ( K v + 1 ) ( 2 Φ v + 1 ) ≤ 2 ( K v + 1 ) ( Φ v + 1 ) and M ( c s ) = O ( M ( s ) ) \mathsf{M}(cs)=O(\mathsf{M}(s)) M ( cs ) = O ( M ( s )) for any constant c c c , as in the analysis of our bottom-up algorithm. We then recover the entries of the matrix of Λ w \Lambda_w Λ w by reading ( K w + 1 ) ( Φ w + 1 ) < ( K v + 1 ) ( Φ v + 1 ) (K_w+1)(\Phi_w+1)<(K_v+1)(\Phi_v+1) ( K w + 1 ) ( Φ w + 1 ) < ( K v + 1 ) ( Φ v + 1 ) coefficients of C ( t , u ) C(t,u) C ( t , u ) , and at most O ( ( K v + 1 ) ( Φ v + 1 ) ) O((K_v+1)(\Phi_v+1)) O (( K v + 1 ) ( Φ v + 1 )) additional operations, which concludes the proof. □ \square □
The matrix Λ r \Lambda_r Λ r is obtained by Lemma H.11 simply exchanging the roles of w w w and r r r , hence processing a node v v v in the top-down pass requires O ( M ( ( K v + 1 ) ( Φ v + 1 ) ) ) O(\mathsf{M}((K_v+1)(\Phi_v+1))) O ( M (( K v + 1 ) ( Φ v + 1 ))) operations. By performing two top-down passes, one for each value of i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } , we thus obtain the contributions S h ( j ) S_h(j) S h ( j ) of the iteration h h h for every j ∈ [ 2 , ℓ ] j \in[2,\ell] j ∈ [ 2 , ℓ ] , and summing over h h h yields the Shapley value of the incorrect classifiers as from Theorem 4.8 . The polynomials P r P_r P r used in step (ii) above, are those computed by the bottom-up phase, and the matrix of Λ v \Lambda_v Λ v has the size of the matrix of P v P_v P v . Therefore, the cost of processing a level of the tree in top-down is bounded as in the bottom-up pass. That is, each of the two top-down passes over i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } for an iteration h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] of the algorithm requires O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) log ℓ ) O(M(K(h)(\Phi(h-1)+1))\log\ell) O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 )) log ℓ ) operations.
We conclude with the resulting time complexity. Recall from the proof of Lemma H.6 that Φ ( col ( x ) − 1 ) < x \Phi(\operatorname{col}(x)-1)<x Φ ( col ( x ) − 1 ) < x for every x ∈ [ 1 , N ⋆ ] x \in[1,N^\star] x ∈ [ 1 , N ⋆ ] , and that col ( x ) \operatorname{col}(x) col ( x ) takes the value h h h for exactly K ( h ) K(h) K ( h ) indices x x x , thus
∑ h = 1 H ⋆ K ( h ) ( Φ ( h − 1 ) + 1 ) = ∑ x = 1 N ⋆ ( Φ ( col ( x ) − 1 ) + 1 ) ≤ ∑ x = 1 N ⋆ x ≤ ( N ⋆ ) 2 . \sum_{h=1}^{H^\star} K(h)(\Phi(h-1)+1)=\sum_{x=1}^{N^\star}(\Phi(\operatorname{col}(x)-1)+1)\leq\sum_{x=1}^{N^\star}x\leq(N^\star)^2 . h = 1 ∑ H ⋆ K ( h ) ( Φ ( h − 1 ) + 1 ) = x = 1 ∑ N ⋆ ( Φ ( col ( x ) − 1 ) + 1 ) ≤ x = 1 ∑ N ⋆ x ≤ ( N ⋆ ) 2 .
Now note that the time complexity of performing an iteration h h h is
O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) log ℓ ) = O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ( N ~ ) log ℓ ) , O(M(K(h)(\Phi(h-1)+1))\log\ell)=O(K(h)(\Phi(h-1)+1)\log(\widetilde{N})\log\ell), O ( M ( K ( h ) ( Φ ( h − 1 ) + 1 )) log ℓ ) = O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ( N ) log ℓ ) ,
by using the bounds M ( s ) = O ( s log s ) M(s)=O(s\log s) M ( s ) = O ( s log s ) , K ( h ) ≤ ℓ − 1 K(h)\leq\ell-1 K ( h ) ≤ ℓ − 1 and Φ ( h − 1 ) ≤ N ~ \Phi(h-1)\leq\widetilde{N} Φ ( h − 1 ) ≤ N , which hold for every h h h and every vote profile. Thus combining the above
O ( log ( ℓ N ~ ) log ℓ ∑ h = 1 H ⋆ K ( h ) ( Φ ( h − 1 ) + 1 ) ) = O ( ( N ⋆ ) 2 log ( ℓ N ~ ) log ℓ ) = O ( ( N ~ ) 2 log ( ℓ N ~ ) log ℓ ) . \begin{aligned}
O\left(\log(\ell\widetilde{N})\log\ell\sum_{h=1}^{H^\star}K(h)(\Phi(h-1)+1)\right)=O\left((N^\star)^2\log(\ell\widetilde{N})\log\ell\right) \\
&=O\left((\widetilde{N})^2\log(\ell\widetilde{N})\log\ell\right).
\end{aligned} O ( log ( ℓ N ) log ℓ h = 1 ∑ H ⋆ K ( h ) ( Φ ( h − 1 ) + 1 ) ) = O ( ( N ⋆ ) 2 log ( ℓ N ) log ℓ ) = O ( ( N ) 2 log ( ℓ N ) log ℓ ) .
Finally, accounting for the processing of each unique vote profile in U U U , we obtain a time complexity bounded by
O ( ∣ U ∣ ( N ~ ) 2 log ( ℓ N ~ ) log ℓ + ∣ D ∣ n ) . O(|U|(\widetilde{N})^2\log(\ell\widetilde{N})\log\ell+|\mathcal{D}|n). O ( ∣ U ∣ ( N ) 2 log ( ℓ N ) log ℓ + ∣ D ∣ n ) .
Consider the bound of Theorem H.7 , both bounds contain the term O ( ∣ D ∣ n ) O(|\mathcal{D}|n) O ( ∣ D ∣ n ) for the evaluation of the classifiers over D \mathcal{D} D . On the remaining term, the above bound is smaller by a factor Θ ( ( N ~ + ℓ ) / ( log ( ℓ N ~ ) log ℓ ) ) \Theta((\widetilde{N}+\ell)/(\log(\ell\widetilde{N})\log\ell)) Θ (( N + ℓ ) / ( log ( ℓ N ) log ℓ )) , showing the improvement in the asymptotic time complexity.
We conclude by noting that such an improvement comes at the price of larger memory complexity. In fact, for a fixed iteration h ∈ [ 1 , H ⋆ ] h \in[1,H^\star] h ∈ [ 1 , H ⋆ ] , the entire tree has memory complexity bounded by O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ℓ ) O(K(h)(\Phi(h-1)+1)\log\ell) O ( K ( h ) ( Φ ( h − 1 ) + 1 ) log ℓ ) . That is, we need to retain all matrices at all O ( log ℓ ) O(\log\ell) O ( log ℓ ) levels required for the top-down pass. Note that at each level such matrices have at most O ( K ( h ) ( Φ ( h − 1 ) + 1 ) ) O(K(h)(\Phi(h-1)+1)) O ( K ( h ) ( Φ ( h − 1 ) + 1 )) entries (see Eq. (35) ). The matrices of the functionals Λ v \Lambda_v Λ v do not add any asymptotic memory complexity. The resulting memory complexity is therefore bounded by O ( ∣ U ∣ ℓ + ℓ N ~ log ℓ ) O(|U|\ell+\ell\widetilde{N}\log\ell) O ( ∣ U ∣ ℓ + ℓ N log ℓ ) .