Abstract 1 Introduction 2 Preliminaries 3 Framework and Computational Problems 4 Exact Algorithms for Expectation (and SHAP Scores) 5 Intractable Cases for Expectation (and SHAP Scores) 6 Exact Computation of the Shapley Value 7 Conclusions References

The Importance of Parameters in Ranking Functions

Christoph Standke ORCID RWTH Aachen University, Germany Nikolaos Tziavelis ORCID University of California Santa Cruz, CA, USA Wolfgang Gatterbauer ORCID Northeastern University, Boston, MA, USA Benny Kimelfeld ORCID Technion, Haifa, Israel
RelationalAI Inc., Berkeley, CA, USA
Abstract

How important is the weight of a given column in determining the ranking of tuples in a table? To address such an explanation question about a ranking function, we investigate the computation of SHAP scores for column weights, adopting a recent framework by Grohe et al. [ICDT’24]. The exact definition of this score depends on three key components: (1) the ranking function in use, (2) an effect function that quantifies the impact of using alternative weights on the ranking, and (3) an underlying weight distribution. We analyze the computational complexity of different instantiations of this framework for a range of fundamental ranking and effect functions, focusing on probabilistically independent finite distributions for individual columns.

For the ranking functions, we examine lexicographic orders and score-based orders defined by the summation, minimum, and maximum functions. For the effect functions, we consider global, top-k, and local perspectives: global measures quantify the divergence between the perturbed and original rankings, top-k measures inspect the change in the set of top-k answers, and local measures capture the impact on an individual tuple of interest. Although all cases admit an additive fully polynomial-time randomized approximation scheme (FPRAS), we establish the complexity of exact computation, identifying which cases are solvable in polynomial time and which are #P-hard. We further show that all complexity results, lower bounds and upper bounds, extend to a related task of computing the Shapley value of whole columns (regardless of their weight).

Keywords and phrases:
Ranking, Explanation, Shapley value, SHAP scores
Funding:
Christoph Standke: ERC grant 101054974 (SymSim) and German Research Foundation grant GRK 2236 (UnRAVeL). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council. Neither the European Union nor the granting authority can be held responsible for them.
Wolfgang Gatterbauer: NSF Career Award IIS-1762268.
Benny Kimelfeld: German Research Foundation grant KI 2348/1-1.
Copyright and License:
[Uncaptioned image] © Christoph Standke, Nikolaos Tziavelis, Wolfgang Gatterbauer, and Benny Kimelfeld; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Information systems Retrieval models and ranking
Related Version:
Full Version: https://arxiv.org/abs/2601.06001 [33]
Editors:
Balder ten Cate and Maurice Funk

1 Introduction

A ranking function takes as input a set of records and produces a permutation over the set based on the entry values (commonly referred to as features) of the records. As ranking is abundant in decision making, it is natural to look for an explanation for the outcome of the ranking of a given dataset. Explanations for ranking functions have received significant attention in the area of Information Retrieval (IR) over recent years [25, 24, 32, 38] and before, as well described in surveys on “explainable IR” [30, 2]. Explanations for ranking can be largely categorized into two types: A value-based explanation aims to elucidate how the values of a certain record led to its being ranked in its position (or why it is included in, or excluded from, the top-k answers); this is typically done by quantifying the contribution of every entry value to the status of the record [1, 9, 25]. On the other hand, a function-based explanation aims to investigate what aspect in the ranking function has led to the outcome, from the point of view of a specific record or the entire permutation; this is typically done by quantifying the contribution of function components to the outcome [37, 14, 19, 32]. This work belongs to the latter kind.

Typically, the ranking function involves parameters. For example, if the ranking is determined by a score function that is a linear combination of the attributes of the record, then the parameters are the weights attached to the features of the record. Previous work in the database community has investigated ways of selecting parameters so that the ranking function satisfies certain criteria [4, 8]. In this work, we study the contribution of the parameter choices to the outcome of the ranking. For that, we adopt the framework of Grohe et al. [18] for measuring the importance of parameters in the context of database queries, where the contribution of a parameter is determined by its SHAP score [23]. In contrast to previous work on the explanation of ranking functions, we focus on the computational complexity of calculating the contribution.

SHAP scores and Shapley values.

The SHAP score [23] is an instantiation of the Shapley value that, in turn, is used to attribute a share to each player in a cooperative game, where each coalition (set of players) gains some utility [31]. The Shapley value, named after its inventor, is unique up to some axioms of rationality (e.g., the sum of shares adds up to the utility of the entire set) [31, 28] and, besides applications in a plethora of domains, has been used for explanations in data-centric fields such as Machine Learning [23, 11, 29], IR [9, 19], and databases [21, 6, 10]. The SHAP score was originally proposed for the purpose of explaining machine-learned models, and particularly attributing responsibility for the outcome of the model to the feature values of a particular instance [23, 20].

Specifically, SHAP is the Shapley value in the cooperative game where the feature values are the players, and the utility of a coalition C is the expected effect (model’s output) of the instance where the feature values of C are used and the rest chosen randomly. In the framework of Grohe et al. [18], the parameter values play the same role that feature values play in the application of SHAP to machine-learning explanations [23, 20] and that feature values play in the application of SHAP to value-based explanations of ranking [26, 9]. Moreover, the Shapley value has recently been used in function-based explanations [19].

Connecting to this work, consider a particular parameterized ranking function, along with a particular choice of values for its parameters. These define a ranking over the given a set of records. To apply the SHAP score, two additional components need to be determined. The first is a distribution from which parameter choices are assumed to be drawn. The second is an effect function that determines how different the ranking obtained from a specific (random) choice of parameters is from the base ranking with the original choice of parameters. The effect function captures different interpretations of what Heuss et al. [19] refer to as “listwise feature attribution.” Similarly to the study of Grohe et al. [18], we restrict the discussion to simple distributions of parameters, namely finite and probabilistically independent parameters (i.e., “fully factorized” distributions [36]).

From the computational perspective, the SHAP score entails an expectation (w.r.t. a random choice of players) over an expectation (over the random parameter choices). Nevertheless, it was shown by Grohe et al. [18] that the SHAP score can also be viewed as a single expectation over an efficiently samplable space; therefore, the SHAP score of a parameter can be computed in polynomial time via sampling if we settle for a randomized additive approximation (FPRAS), under the mild assumption that the effect function is computable in polynomial time. This technique allows additive approximations also for more general classes of probability distributions, including fully factorized continuous distributions that allow efficient sampling. Moreover, if we make a data complexity assumption of a fixed number of parameters, then the SHAP score can be computed in polynomial time via an explicit enumeration of the probability space. We investigate the ability to compute the SHAP score exactly (and deterministically), for a given (non-fixed) number of parameters, in polynomial time. Van den Broeck et al. [36] have established that there are polynomial-time reductions in both directions between the computation of the SHAP score and the computation of the expected effect, which is arguably a simpler notion. Hence, following their result, we focus mainly on the expected effect throughout the paper.

Studied ranking and effect functions.

Our study considers a variety of basic ranking functions and effect functions. For ranking, we consider the score functions of 𝖲𝗎𝗆, 𝖬𝗂𝗇, and 𝖬𝖺𝗑, and the lexicographic ordering (descending or ascending). In all of these functions, the parameters are coefficients (weights) over the record attributes. We view the dataset simply as a matrix (where every row corresponds to a record), and the parameters as per-column multiplicative weights. For the effects, we consider three types: global measures determine an effect over the entire ranking, top-k measures determine the impact on the set of top-k answers, and local measures determine the impact on a single record. The global measures we consider are standard distances between permutations [27, 5], and specifically Kendall’s tau, maximum displacement, and Hamming distances between the random ranking (due to the random choice of parameters) and the base ranking. The top-k measures include the symmetric difference between the top-k sets (for the base and random rankings) and the binary indicator of whether there is any difference between the top-k sets. The local measures include the change in the record’s position and the change in its status of membership in the set of top-k answers. A detailed example is presented at the end of Section 3.

Contributions.

We begin with algorithms for a simpler task: given two records r1 and r2, compute the probability (for randomly chosen parameters) that r1 precedes r2 in the ranking. This problem is tractable for all the ranking functions we consider, while for 𝖲𝗎𝗆 we make the necessary assumption that the numbers are in unary representation (as the problem is FP#P-hard111Recall that FP#P is the class of functions computable in polynomial time using an oracle to some function in #P. A function F is FP#P-hard if there is a polynomial-time Turing reduction from every function in FP#P to F. Such a problem is at least as hard as every problem in the polynomial hierarchy [34]. for the binary representation). Our results (summarized in Table 1) show that, in general, this pairwise case suffices for the tractability of some of the effect functions, namely Kendall’s tau and the position and top-k membership of a row for small k; for the rest, we prove hardness results. We also consider the case where the number of records is bounded, thus, we have a small number of competitors. There, we prove that all problems become tractable, again with the exception of 𝖲𝗎𝗆 with binary numeric representation.

Finally, we consider another variation of a function-based explanation for ranking, now parameter-free. The goal is to compute the contribution of whole columns (attributes) to the ranking. More precisely, we consider the Shapley value of the cooperative game where the players are the columns, and the utility of a set of columns is the effect of the ranking obtained by considering only the columns in the set, while ignoring the rest. This task has been presented by Heuss et al. [19] where they refer to the action of ignoring a column as “masking the feature vector,” yet with no complexity analysis. We show that this problem reduces in polynomial time to the problem in the focus of this paper, namely computing the SHAP score of parameter choices. Hence, our algorithms for the SHAP score of parameters can be used for the Shapley value of columns. Moreover, we show that the hard cases of computing the SHAP scores are hard already for the Shapley value of columns.

Organization.

We begin with preliminary definitions in the next section. In Section 3, we describe the formal framework and computational problems that we study, namely the SHAP score of parameters, the expected effect, and the Shapley value of columns. We give algorithms for the expectation in Section 4 and establish lower bounds in Section 5. Finally, we discuss extensions to the Shapley value of columns in Section 6, and conclude in Section 7. For space limitations, some of the proofs are given in the archive version of this paper [33].

Table 1: Summary of the complexity results. The complexity for the Hamming distance is the same as MD (maximum displacement). The complexity results for the effects of the top-k perspective are the same as the top-k membership. All problems are solvable in polynomial time when the number of attributes is fixed. They are also solvable in polynomial time when the number of records is fixed, with the exception of 𝖲𝗎𝗆 with binary numerical representation. All FP#P-hardness results are actually FP#P-completeness, due to standard techniques probability computation in FP#P [17, 13].
Global Local
Top-k membership
Ranking Effect Kendall’s τ MD Position Fixed k Given k
𝖲𝗎𝗆 unary P FP#P-h. P FP#P-h. FP#P-h.
𝖲𝗎𝗆 binary FP#P-h. FP#P-h. FP#P-h.
𝖬𝖺𝗑 𝖺𝗌𝖼 / 𝖬𝗂𝗇 𝖽𝗌𝖼 P FP#P-h. P FP#P-h. FP#P-h.
𝖬𝖺𝗑 𝖽𝗌𝖼 / 𝖬𝗂𝗇 𝖺𝗌𝖼 P P P
Lexicographic P P FP#P-h.

2 Preliminaries

We begin with preliminary concepts and terminology that we use throughout the paper.

Matrices and permutations.

For a natural number n, we denote by [n] the set {1,,n}, and by 𝒮n the set of permutations over [n] (i.e., bijective functions π:[n][n]). By π𝗂𝖽 we denote the identity permutation defined by π𝗂𝖽(i)=i for all i[n]. By 𝒮 we denote the set of all permutations, that is, 𝒮n𝒮n. We denote by n×m the set of all n×m matrices, over the rational numbers, with n rows and m columns, and by the set of all matrices of all dimensions (i.e., n,mn×m). If 𝐌n×m and C{1,,m} represents a set of columns, then we denote by 𝐌|C the n×|C| matrix obtained from 𝐌 by removing all columns except those in C. In other words, 𝐌|C is the projection of 𝐌 on C under bag semantics. We may refer to a row of a matrix as a tuple. We denote such a row (and every numeric vector) 𝐯 in boldface and its jth entry with 𝐯[j].

Computation-wise, we assume every number is represented as a pair (a,b), standing for the rational number a/b, where a and b are integers in a binary representation. When we refer to a unary representation, we mean an integer a encoded as a string of length a.

Ranking functions.

By a ranking function we refer to a function r:𝒮 that maps every matrix 𝐌n×m to a permutation in 𝒮n; hence, r ranks the rows of its input matrix 𝐌. Specifically, we will focus on several ranking functions r:

  • Ranking by decreasing/increasing score of a row (a1,,am), with the score being the sum of the aj, denoted 𝖲𝗎𝗆, the maximum among the aj, denoted 𝖬𝖺𝗑, or the minimum among the aj, denoted 𝖬𝗂𝗇. For each scoring function s, we denote by rs𝖽𝗌𝖼 and rs𝖺𝗌𝖼 the rankings by decreasing and increasing s, respectively. For example, we have rs𝖽𝗌𝖼(i)<rs𝖽𝗌𝖼(j), meaning that the ith row 𝐭i precedes the jth row 𝐭j, whenever s(𝐭i)>s(𝐭j).

  • Ranking by the lexicographic ordering (left to right) over the rows, denoted r𝖫𝖾𝗑.

In our analysis, the direction of the ranking with respect to the score (increasing/decreasing) is important for ranking by 𝖬𝗂𝗇 and 𝖬𝖺𝗑, as shown in Table 1. This direction is not important for ranking by 𝖲𝗎𝗆 since we can switch between the directions by multiplying the entries by a negative number (or subtracting each value from the maximum value in the matrix); hence, we simply write r𝖲𝗎𝗆 as standing for r𝖲𝗎𝗆𝖺𝗌𝖼 (since r𝖲𝗎𝗆𝖽𝗌𝖼 is equivalent). In the lexicographic order, we assume for the same reason that the order of each column is ascending (i.e., lower numbers precede higher numbers). Also for the same, we will not consider ranking by 𝖬𝗂𝗇 explicitly since it is the same as ranking by 𝖬𝖺𝗑 of the negated matrix in reversed direction.

For the framework to be well-defined, we need to handle tie-breaking. For that, we will use the ordering by the row indices; that is, if the rows i and i are tied by the ordering and i<i, then we give precedence to the ith row.

Shapley value.

A cooperative game is a pair (P,ν) where P is a finite set of players and ν:2P is a utility function that associates with every coalition CP a value ν(C), so that ν()=0. The Shapley value of a player pP is defined by the following formula [28, 31].

Shapley(p,ν)=CP{p}|C|!(|P||C|1)!|P|!(ν(C{p})ν(C)) (1)

Intuitively, we consider the situation where we select players iteratively without replacement, starting with the empty set; the Shapley value of a player pP is the mean increase in utility when adding p.

SHAP score.

Let f:Dm be an m-ary function over some domain D. Let Π be a discrete distribution over Dm, and let 𝐰=(w1,,wm) be a tuple from Π with a nonzero probability. For j=1,,m, the SHAP score of j with respect to (w.r.t.) 𝐰, denoted Shap(j,f,𝐰), is the value Shapley(j,ν) for the cooperative game (P,ν) defined as follows [23].

  • P{1,,m};

  • ν(C)𝔼𝐮Π[f(𝐮)u=w for all C].

That is, the utility of a subset C of parameters is the expectation of f over the distribution Π, conditioned on every parameter in C having its specific value from 𝐰.

3 Framework and Computational Problems

Our goal is to compute the contribution of columns and column weights to the ranking of the rows of a given matrix. For that, we need to reason about how different the ranking would be had we eliminated certain columns or changed their weights. Therefore, we need to adopt a measure of difference between permutations. We refer to such measures as effect functions, as they determine the effect of the column alteration.

Effect functions.

We are given a matrix 𝐌 and a ranking function r with original order π0r(𝐌). As a result of applying the ranking function with different weights on the columns (or only on a subset of columns), we get a different permutation π. We will focus on three classes of effect functions:

  • Global perspective: How far is π from the original permutation? We can use several notions of distance between permutations. We give here three conventional ones, where the first two were used for ranking explanation in the RankSHAP work [9].

    • Kendall’s tau: e𝗄τ(π)1i<jn𝟙π0(i)<π0(j)π(i)>π(j) determines the number of pairwise disagreements (swaps) between π and the original order. This effect function has the range [n(n1)2].

    • Maximum Displacement (MD) distance: e𝗆𝖽(π)max1in|π(i)π0(i)| is the maximum difference of an item’s position between the two permutations. This difference is a number in [n1].

    • Hamming distance: e𝖧𝖺𝗆(π)1in𝟙π(i)π0(i) determines the number of positions where the tuple is different between the original and permuted orders. It can attain values in [n].

  • Top-k perspective: What is the impact on the set of top-k answers? For that, let T={π1(1),,π1(k)} and T0={π01(1),,π01(k)} we will consider two functions.

    • Top-k difference: eΔk(π)|TT0||TT0| is the size of the symmetric difference between the sets of top-k elements.

    • Top-k any-change: e𝖺𝗇𝗒k(π)𝟙TT0 determines whether there is any change in the top-k elements.

  • Local perspective: What is the impact on a specific row i? We will consider two functions:

    • Position: e𝗉𝗈𝗌(i,π)π(i)π0(i) is the change of position of the ith row and is in the range {n+1,,n1}.

    • Top-k membership: e𝗍𝗈𝗉k(i,π)𝟙π(i)k𝟙π0(i)k determines how the ith row changes its membership in the top-k tuples. Its range is either {1,0} or {0,1}.

In the analysis we conduct in the remainder of this paper, we focus on four effects: Kendall’s tau, MD, position, and top-k membership. The complexity results for the Hamming distance are the same as those of MD. The complexity results for the impacts of the top-k perspective are the same as the top-k membership. Details are in the archive version [33].

Computing SHAP scores.

Next, we assume that the columns of the input matrix 𝐌 are weighted, and the goal is to compute the SHAP score of a given weight. To make it precise, we assume that our data is a pair (𝐌,𝐰), where 𝐌n×m and 𝐰=(w1,,wm)m is a sequence of column weights. The pair (𝐌,𝐰) represents the pair 𝐌𝐰, which is the matrix 𝐌 obtained by multiplying the jth column by wi for i=1,,m; that is, we apply element-wise multiplication by 𝐰 to each row of 𝐌, or, in other words, 𝐌=𝖽𝗂𝖺𝗀(𝐰)𝐌 where 𝖽𝗂𝖺𝗀(𝐰) is the diagonal matrix whose diagonal elements are given by 𝐰.

We will also assume that, in addition to 𝐌 and 𝐰, we are given a finite probability distribution Π over m. We restrict our complexity study to column-wise independent distributions (i.e., fully factorized distributions [36]), hence, Π is represented by finite distributions Π1,,Πm over for each weight parameter, each distribution given as a list of value-probability-pairs; the total number of such pairs is denoted by |Π|.

Let r be a ranking function and e an effect function. Given the pair (𝐌,𝐰) and a column number j, our goal is to compute Shap(j,f,𝐰), where f(𝐮)e(r(𝐌𝐮)), that is, the inverse of the effect on the ranking of replacing the weights of 𝐰 with those of 𝐮. We denote this value by Shapr,e(j,𝐌,𝐰,Π). The reason for the inverse (using minus) is that the closer we are to the original ranking order π0 (i.e., the less effect), the higher we deem the contribution to the the actual π0 in place.

Problem: 𝖲𝖧𝖠𝖯r,e: SHAP score computation
Fixed: Ranking function r and effect function e
Input: Matrix 𝐌, weight vector 𝐰, distribution Π, and column number j of 𝐌
Goal: Compute Shapr,e(j,𝐌,𝐰,Π)

In this and the other problems we consider, when the effect function e is local, the input also includes the row number i of the effect. In addition, when e is the top-k membership, then the input also includes k (unless we explicitly state that k is assumed to be fixed).

It has been established by Van den Broeck et al. [36] that, for finite and probabilistically independent parameters, calculating the SHAP score is computationally equivalent to calculating the expected value of f, which is arguably simpler to handle.

Theorem 1 ([36, Theorem 2]).

Let f be a function that can take any number of numerical arguments and can be computed in polynomial time. The following problems are polynomially (Turing) reducible to each other.

  1. 1.

    Compute Shap(j,f,𝐰), given 𝐰, j and Π.

  2. 2.

    Compute 𝔼𝐮Π[f(𝐮)], given m and Π.

Hence, we will also study the following problem.

Problem: 𝖤𝖷𝖯r,e: Expectation computation
Fixed: Ranking function r and effect function e
Input: Matrix 𝐌 and distribution Π
Goal: Compute 𝔼𝐮Π[e(r(𝐌𝐮))]

Computing Shapley values.

Let r be a ranking function and e an effect function. Given a matrix 𝐌n×m and a column number j{1,,m}, the Shapley value of the jth column is defined as Shapley(i,ν) for the game (P,ν) defined as follows:

  • P{1,,m}.

  • ν(C)e(r(𝐌|C)), that is, the inverse of the effect on the ranking we obtain by applying r to only the columns of C (with the same rationale for inverse as SHAP).222The ranking function r applied to the empty set of columns always yields the matrix order π𝗂𝖽 since all tuples of 𝐌| are identical. In particular, this definition does not depend on the value of the scoring function on the empty set.

We denote this value by Shapleyr,e(j,𝐌).

Problem: 𝖲𝗁𝖺𝗉𝗅𝖾𝗒r,e: Shapley value computation
Fixed: Ranking function r and effect function e
Input: Matrix 𝐌 and a column number j of 𝐌
Goal: Compute Shapleyr,e(j,𝐌)

Approximation.

Before moving to exact algorithms, we want to emphasize that each of the three problems 𝖤𝖷𝖯r,e, 𝖲𝖧𝖠𝖯r,e, and 𝖲𝗁𝖺𝗉𝗅𝖾𝗒r,e can be efficiently additively approximated whenever r and e can be computed in polynomial time and the range of e is polynomial in the number of rows. This is the case for all ranking and effect functions introduced in this section. As we will show in Section 5.2, this is not always the case for multiplicative approximations. The additive approximation can be done via basic Monte-Carlo-sampling since all three problems can be expressed as the expectation of a random variable over a probability space that allows efficient sampling: Π for 𝖤𝖷𝖯r,e, 𝒮m for 𝖲𝗁𝖺𝗉𝗅𝖾𝗒r,e, and Π×𝒮m for 𝖲𝖧𝖠𝖯r,e. We can use this insight for efficient additive approximations also in the case of not necessarily independent discrete parameter distributions under very mild assumptions (see [18]) or independent continuous parameter distributions that can be sampled efficiently.333For continuous distributions, the definition of the SHAP score via conditional representations is not well-defined since the set we condition on has measure 0. In the case of independent distributions, we can derive a compatible definition via disintegration, that is, fixing the parameters in C to their reference values and choosing the others at random. This simple idea was further improved to allow for faster additive approximations (e.g. [7]). Hence, our framework could be applied in practice, even in cases where we show that exact computation is hard.

A detailed example.

Before we start our complexity analysis, let us first look at a small example that demonstrates the framework in detail. Consider the following matrix 𝐌:

id a1 a2
1 20 26
2 30 13
3 40 0
4 0 39

Assume that we rank the row by 𝖲𝗎𝗆 in descending order with a scoring parameter 𝐮{1,2}×{1,2}. We want to measure the impact of choosing the weight vector 𝐰=(1,1) among the possible choices for 𝐮 (where we assume a uniform distribution).

To measure this, we first determine the rankings for each 𝐮: For 𝐮=𝐰=(1,1), the scores are (46,43,40,39), so we obtain the ranking (1,2,3,4). In the same way, we obtain (4,1,2,3) for 𝐮=(1,2), (3,2,1,4) for 𝐮=(2,1), and again (1,2,3,4) for 𝐮=(2,2).

𝐮 scores permutation π e𝗄τ=d𝗄τ(π,π0) e𝗉𝗈𝗌(4,π)
𝐰=(1,1) (46,43,40,39) π0=(1,2,3,4) 0 4
(1,2) (72,56,40,78) (4,1,2,3) 3 1
(2,1) (66,73,80,39) (3,2,1,4) 3 4
(2,2) (92,86,80,78) (1,2,3,4) 0 4

Now, we need to choose an effect function e that measures the distance between two rankings. We will look at the Kendall’s tau distance e𝗄τ and the position of the fourth row e𝗉𝗈𝗌(4,π). We observe that d𝗄τ((1,2,3,4),(4,1,2,3))=d𝗄τ((1,2,3,4),(3,2,1,4))=3 and that the row 4 is in the last position of all the rankings except for (4,1,2,3) where it is first.

For the SHAP score calculation, the valuation of a set of columns C is the expected value of the negated effect function when we fix the parameter value for the columns in C to the value of 𝐰 and choose the rest at random. For example, for C={2}, we obtain for e=e𝗄τ

ν𝗄τ({2}) =e𝗄τ(r𝖲𝗎𝗆(𝐌(1,1)))+e𝗄τ(r𝖲𝗎𝗆(𝐌(2,1)))2
=d𝗄τ((1,2,3,4),(1,2,3,4))+d𝗄τ((1,2,3,4),(3,2,1,4))2=32,

and for e=e𝗉𝗈𝗌(4,π), we obtain ν𝗉𝗈𝗌(4)({2})=(44)+(44)2=0. Calculating the valuation ν of every C{1,2} gives the following. For e=e𝗄τ, we obtain Shap(1)=12(ν𝗄τ({1,2})ν𝗄τ({2}))+12(ν𝗄τ({2})ν𝗄τ())=12(0(32))+12(32(32))=34 and Shap(2)=34 as well, so both parameter choices have the same impact w.r.t. global changes in the ranking measured by d𝗄τ. This reflects the symmetry in the 4th column of table above. In contrast, for e=e𝗉𝗈𝗌(4,π), we obtain Shap(1)=38 and Shap(2)=98. This matches our intuition that fixing the second weight to 1 is bad for the ranking of row 4, since the only good weighting vector for row 4 is 𝐮=(1,2).

In the remainder of the paper, we study the complexity of exactly solving the computational problems we defined in this section.

4 Exact Algorithms for Expectation (and SHAP Scores)

In this section, we show the tractability results of Table 1 for 𝖤𝖷𝖯r,e – computing the expected effect. Combined with Theorem 1, these give the tractability results of the table for the SHAP score. We begin a more basic problem that we later use for expectation.

4.1 Algorithms for the Pairwise Case

We begin with the following problem: Given tuples x and y, what is the probability that x precedes y in the ranking? Since we only care about their relative order, we can ignore all the other tuples in the table and assume n=2. Although this pairwise case may seem highly restricted, we will see in the next section that it forms the foundation of all our algorithms.

Problem: 𝖯𝖱𝖤𝖢r: Precedence probability computation
Fixed: Ranking function r
Input: Matrix 𝐌 with two rows, distribution Π
Goal: Compute 𝐮Π[s(1)<s(2)] where s stands for r(𝐌𝐮)

A naive way to compute the probability of precedence is to iterate through the exponentially many choices of weights 𝐮 and check whether tuple precedence holds in the resulting order. We exploit the fact that many of these choices can be grouped together, allowing us to consider only a polynomial number of possibilities. This can be achieved for all ranking functions discussed in this paper, except for 𝖲𝗎𝗆 where our algorithm is pseudo-polynomial, that is, polynomial in the magnitude of the given values.

Theorem 2.

The problems 𝖯𝖱𝖤𝖢r𝖬𝖺𝗑𝖺𝗌𝖼, 𝖯𝖱𝖤𝖢r𝖬𝖺𝗑𝖽𝗌𝖼, and 𝖯𝖱𝖤𝖢r𝖫𝖾𝗑 are solvable in polynomial time. The problem 𝖯𝖱𝖤𝖢r𝖲𝗎𝗆 is solvable in polynomial time if the matrix 𝐌 and the weights in Π are integers encoded in unary.

We now give the algorithm for each ranking function in Theorem 2. For readability, we use 𝐱 and 𝐲 for the two tuples 𝐭1 and 𝐭2 in the matrix. Our goal is to compute the probability that 𝐱 precedes 𝐲; without loss of generality, we assume that this is false in the event of a tie.

Sum ranking.

For 𝖲𝗎𝗆, our algorithm relies on dynamic programming and follows a similar approach to the standard pseudo-polynomial algorithm for the counting knapsack problem [16]. Specifically, we consider a subproblem where the matrix 𝐌 is restricted to columns j,,m and compute the probability that tuple 𝐲 surpasses tuple 𝐱 by (strictly) more than s in total score. This can be expressed recursively by considering how the score difference changes when removing the j-th column for each assignment to the weight uj:

R[j,s]=vjsupp(Πj)[uj=vj]R[j+1,svj(𝐲[j]𝐱[j])] (2)
R[m+1,s]=1 if s>0, and R[m+1,s]=0 if s0 (3)

The final answer is R[1,0]. The running time is 𝒪(|Π|s) where s is the number of possible values for s in our dynamic program. If the input consists of integers given in unary, then s is polynomial in the input size. Indeed, suppose the matrix 𝐌 contains integers in the range [c,c] and the weights in Π are in the range [b,b]. Then s will be bounded by j=1mb2c, which is in 𝒪(mbc).

Max ranking.

For the 𝖬𝖺𝗑 ranking function, the key idea is that the “winner” in the comparison between the two tuples is determined by a single column – the one with the maximum value. Thus, we can break the problem into distinct cases, each corresponding to a specific column determining the outcome.

Example 3.

Let 𝐱=(3,5,2) and 𝐲=(4,1,6) be two tuples, and suppose that the weights 𝐮 are drawn uniformly from {0,1}, and the ranking function is r𝖬𝖺𝗑𝖺𝗌𝖼. For 𝐱 to be ranked before 𝐲, we need max(u13,u25,u32)<max(u14,u21,u36). We consider three distinct cases where this event occurs: (Case 1) The first 𝐲-coordinate u13 is the overall maximum. We iterate over possible values of u1, and for each one, we determine the valid weights for u2 and u3 individually. If u1=0, then u13 cannot be the winner. If u1=1, then the valid sets of weights are: u1{1}, u2{0}, u3{0}. This occurs with probability 1/8. (Case 2) The second 𝐲-coordinate u21 is the overall maximum. This cannot happen. (Case 3) The third 𝐲-coordinate u36 is the overall maximum. Here, we obtain the sets u1{0,1}, u2{0,1}, u3{1}. All combinations of these weights are valid, thus the probability is 4/8. Summing up the probabilities from the valid cases, we obtain the final result 5/8.  

Algorithm 1 builds on the logic of our example, decomposing the comparison of two maximum predicates into m distinct cases, and computing their probabilities efficiently. Some care is required in the event of ties among columns of 𝐲; in such cases, we elect the first occurring maximum to be the winner, ensuring that the m cases remain distinct. The decomposition can be expressed as follows:

(max(𝐲𝐮)>max(𝐱𝐮))j[m]vjsupp(Πj)Wj,vj (4)
Wj,vj=(vj𝐲[j]>vj𝐱[j])(k[j]vj𝐲[j]>uk𝐱[k]) (5)
(k[j1]vj𝐲[j]>uk𝐲[k])(k[j+1,m]vj𝐲[j]uk𝐲[k])

The algorithm constructs these distinct events Wj,vj and for each one, it determines sets of valid weights for 𝐮, except for position j where the weight has been fixed to vj. Finally, the probability of these events is computed efficiently, since the distributions Πj are independent. The running time of the algorithm is 𝒪(|Π|2).

Algorithm 1 Precedence computation for ranking by 𝖬𝖺𝗑 ascending.

Lexicographic ranking.

We now move on to ranking by lexicographic orders. Our algorithm again follows a decomposition into non-overlapping events, each corresponding to a specific column and its weight determining the outcome. For this to happen, all preceding columns need to be tied between the two tuples. The decomposition works as follows:

((𝐲𝐮)>𝖫𝖾𝗑(𝐱𝐮)j[m]vjsupp(Πj)Wj,vj (6)
Wj,vj=(vj𝐲[j]>vj𝐱[j])(k[j1]vj𝐲[j]=uk𝐱[k]) (7)

Similarly to the case of 𝖬𝖺𝗑, we construct these events, determine the valid weight assignments 𝐮 for each one, and calculate their probability. The running time is 𝒪(|Π|2).

Recovering the satisfying weights.

In some cases, we need not only the probability that tuple 𝐱 is before tuple 𝐲, but also a succinct representation of the weights for which this is true. Fortunately, our decomposition-based algorithms for 𝖬𝖺𝗑 and 𝖫𝖾𝗑 provide this directly. We simply need to replace summation with union and multiplication with set product in line 18 of Algorithm 1.

Observation 4.

The algorithms for 𝖯𝖱𝖤𝖢r𝖬𝖺𝗑𝖺𝗌𝖼, 𝖯𝖱𝖤𝖢r𝖬𝖺𝗑𝖽𝗌𝖼, and 𝖯𝖱𝖤𝖢r𝖫𝖾𝗑 can additionally return the weights 𝐮 for which precedence holds as a disjoint list, where each element consists of a set of valid weights per column, i.e., ×jm(uj=vj).

4.2 From Pairwise Impact to Ranking Impact

We now extend the polynomial-time algorithms for the pairwise case to the expected effect on the overall ranking. When the effect function measures the position of a tuple or Kendall’s tau for the entire permutation, we can reduce the problem to a polynomial number of calls to 𝖯𝖱𝖤𝖢r. For both measures, we can write the expected effect as the expectation of a sum of indicator variables for tuple precedence and then use the linearity of expectation.

Theorem 5.

For ranking function r{r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖬𝖺𝗑𝖽𝗌𝖼,r𝖫𝖾𝗑} and effect function e{e𝗄τ,e𝗉𝗈𝗌}, the problem 𝖤𝖷𝖯r,e is solvable in polynomial time. For ranking function r=r𝖲𝗎𝗆 and effect function e{e𝗄τ,e𝗉𝗈𝗌}, the problem 𝖤𝖷𝖯r,e is solvable in polynomial time if the matrix 𝐌 and the weights in Π are integers encoded in unary.

The final case that admits a polynomial-time algorithm is the expected top-k membership for fixed k and ranking by r𝖬𝖺𝗑𝖽𝗌𝖼. Interestingly, our approach only applies to a descending order, and in fact, we prove in the next section that the problem is hard when the order is ascending. The key idea of the algorithm is that, for this specific ranking function, we can compute the probability that the tuple of interest beats a small subset of other tuples.

𝐭1 3 1 0
𝐭2 1 0 4
𝐭3 0 1 1
𝐭4 2 2 2
𝐭 3 1 4
𝐭4 2 2 2
Figure 1: Example 6: The transformation to the pairwise case for r𝖬𝖺𝗑𝖽𝗌𝖼 and top-k membership.
Example 6.

Suppose the matrix 𝐌 contains tuples 𝐭1,𝐭2,𝐭3,𝐭4 as shown in Figure 1, the ranking function is r𝖬𝖺𝗑𝖽𝗌𝖼, and our goal is to compute the probability that 𝐭4 is ranked top-1. We can merge the competitor tuples 𝐭1,𝐭2,𝐭3 into a single competitor 𝐭 that retains the largest value per column. Now, 𝐭4 is top-1 precisely when it precedes 𝐭 in the ranking. This merging has effectively reduced the problem to the pairwise problem 𝖯𝖱𝖤𝖢r𝖬𝖺𝗑𝖽𝗌𝖼, which we have already established can be solved efficiently.  

The example illustrates how the algorithm works when k=1. For k>1, we apply the principle of inclusion-exclusion to express the event that our tuple is in the top-k as the intersection of events where it ranks above specific subsets of other tuples.

Theorem 7.

The problem 𝖤𝖷𝖯r𝖬𝖺𝗑𝖽𝗌𝖼,e𝗍𝗈𝗉k with k as a fixed parameter is solvable in polynomial time.

Later, we will show that the assumption of a fixed k is necessary since the problem becomes intractable otherwise (Theorem 12).

4.3 Bounding the Matrix Dimensions

We conclude this section by investigating the consequences of bounding one of the two dimensions of our matrix by a fixed constant. This allows us to obtain a clearer picture of the parameters that make the problem hard. We find that such a restriction makes the problem significantly easier and, in most cases (with the exception of 𝖲𝗎𝗆 with arbitrary values), both dimensions need to be non-fixed for the problem to be hard.

Theorem 8.

The following hold.

  1. 1.

    If the number m of columns of the matrix 𝐌 is bounded by a constant, then the problem 𝖤𝖷𝖯r,e is solvable in polynomial time for any ranking function r and effect function e computable in polynomial time.

  2. 2.

    If the number n of rows of 𝐌 is bounded by a constant, then the problem 𝖤𝖷𝖯r,e is solvable in polynomial time for any effect function e computable in polynomial time and

    1. (a)

      the ranking function r is in {r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖬𝖺𝗑𝖽𝗌𝖼,r𝖫𝖾𝗑}, or

    2. (b)

      r is the ranking function r𝖲𝗎𝗆 and, additionally, the matrix 𝐌 and weights in Π are integers encoded in unary.

We note that the proof is straightforward for the cases where m (the number of columns) is fixed, since we can then materialize the entire probability space in an explicit representation. The proof of tractability for a fixed number of n of rows is more involved.

5 Intractable Cases for Expectation (and SHAP Scores)

We now show that the collection of tractability results in Section 4 is complete in the sense that expectation (and SHAP) computations are 𝖥𝖯#𝖯-hard for all remaining combinations of r and e.

5.1 Ranking based on Summation

We start with the observation that precedence probability is hard for ranking by 𝖲𝗎𝗆.

Theorem 9.

𝖯𝖱𝖤𝖢r𝖲𝗎𝗆 is 𝖥𝖯#𝖯-hard, if the input matrix 𝐌 is encoded in binary.

The proof of this theorem is given in the archive version [33]. We use the following lemma to prove this claim by reducing from the counting knapsack problem that, given natural numbers b1,,b and a number d all encoded in binary, asks for the number of subsets S[] with iSbid. This problem is known to be #𝖯-hard (see, e.g., [12, 16]).

Lemma 10.

Let b1,,b and d be an input to the counting knapsack problem. Then, there is a matrix 𝐌2×(+1) with the following property: For each set C of columns, we have r𝖲𝗎𝗆(𝐌|C)(2)r𝖲𝗎𝗆(𝐌|C)(1) if and only if C contains +1 and iC{+1}bid.

Proof.

Consider the following matrix 𝐌2×(+1):

id a1 an an+1
1 0 0 d+1
2 b1 bn 0

It is easy to verify this has the claimed property.

We can use this theorem to show the hardness of expectation computation (and hence SHAP score computation) whenever we rank by 𝖲𝗎𝗆.

Corollary 11 (from Theorem 9).

For each of the effect functions e{e𝗄τ,e𝖧𝖺𝗆,e𝗉𝗈𝗌,e𝗍𝗈𝗉k}, the problem 𝖤𝖷𝖯r𝖲𝗎𝗆,e is 𝖥𝖯#𝖯-hard if the input matrix 𝐌 is encoded in binary.

Proof.

We observe that for n=2, expectation computation of the effect functions e{e𝗄τ,e𝖧𝖺𝗆,e𝗉𝗈𝗌} is equivalent to precedence probability computation, as they are all of the form a(π(1)>π(2))+b(π(2)>π(1)) with ab.

For 𝐌2×m, k1 and e=e𝗍𝗈𝗉k, we consider a matrix 𝐌(k+1)×m where 𝐭𝟏=𝐭1 and 𝐭𝟐==𝐭𝐤+𝟏=𝐭2, so all the tuples 𝐭𝟐 up to 𝐭𝐤+𝟏 are identical. Now, 𝐭𝟏 is in the top-k of 𝐌 is equivalent to 𝐭1 being ranked better than 𝐭2 in 𝐌. This yields the claim.

5.2 Top-k Membership

In Section 4, we saw a polynomial-time algorithm for 𝖤𝖷𝖯r𝖬𝖺𝗑𝖽𝗌𝖼,e𝗍𝗈𝗉k when k is a parameter. We now show that this problem is hard for all other ranking functions we consider.

Theorem 12.

For each ranking function r{r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖲𝗎𝗆,r𝖫𝖾𝗑} the problem 𝖤𝖷𝖯r,e𝗍𝗈𝗉k is 𝖥𝖯#𝖯-hard, when k is a parameter and also when k is part of the input. Furthermore, 𝖤𝖷𝖯r𝖬𝖺𝗑𝖽𝗌𝖼,e𝗍𝗈𝗉k is 𝖥𝖯#𝖯-hard if k is part of the input. These claims remain true if the entries of 𝐌 are restricted to {0,1} and the distribution Π is the uniform distribution on {0,1}m.

We prove this theorem (in the archive version [33]) using a reduction from counting satisfying assignments to positive CNF formulas. This problem is known to be #𝖯-hard [35]. Before we continue, we fix some notation for the remainder of this section. Let X1,,Xm be Boolean variables. A vector 𝐮{0,1}m defines an assignment α[𝐮]:[m]{𝗍𝗋𝗎𝖾,𝖿𝖺𝗅𝗌𝖾} by interpreting 1 as 𝗍𝗋𝗎𝖾 and 0 as 𝖿𝖺𝗅𝗌𝖾. A set C[m] defines the assignment α[C]=α[𝟙C], where 𝟙C{0,1}m is the incidence vector of C.

Example 13.

We illustrate how the satisfiability of a CNF formula can be modeled using the top-1 membership problem. Let our formula be (X1X2X4)(X1X3)(X2X3X4). We construct the matrix shown in Figure 2, with columns corresponding to formula variables and tuples 𝐭1,𝐭2,𝐭3 corresponding to clauses. A value of one indicates that the corresponding variable appears in the clause. Now, let the column weights be {0,1}, representing whether a variable is 𝗍𝗋𝗎𝖾 or 𝖿𝖺𝗅𝗌𝖾, and let the ranking function be r𝖬𝖺𝗑𝖺𝗌𝖼. By our construction, 𝐭4 is top-1 if and only if all clauses are satisfied.  

We are now ready to state our main tool for the proof of Theorem 12.

𝐮 1 0 0 1
𝐭4 0 0 0 0
𝐭1 1 1 0 1
𝐭2 1 0 1 0
𝐭3 0 1 1 1
𝐮 0 0 0 1
𝐭2 1 0 1 0
𝐭4 0 0 0 0
𝐭1 1 1 0 1
𝐭3 0 1 1 1
Figure 2: Example 6: 𝐭4 is top-1 under r𝖬𝖺𝗑𝖺𝗌𝖼 iff 𝐮 gives a satisfying assignment for (X1X2X4)(X1X3)(X2X3X4). The left is a satisfying assignment, while the right one is non-satisfying.
Lemma 14.

Let ϕ=i=1Di be a positive CNF formula with variable set X1,,Xm and clauses Di=j=1riXji. Furthermore, let k. Then, there is a matrix 𝐌(+k)×m with entries in {0,1} and the following property: For each set C of columns and each ranking function r{r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖲𝗎𝗆,r𝖫𝖾𝗑}, we have r(𝐌|C)(k+)k if and only if the assignment α[C] models ϕ.

 Remark 15.

Using [3, Corollary 10], the previous lemma directly shows that we cannot approximate SHAP scores for r{r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖲𝗎𝗆,r𝖫𝖾𝗑} and e=e𝗍𝗈𝗉k unless 𝖱𝖯=𝖭𝖯.

5.3 Maximum Displacement Distance

In this section, we prove that expectation computation is a hard problem if we measure the effect using the maximum displacement distance d𝗆𝖽(π1,π2)=max1in|π1(i)π2(i)|.

Theorem 16.

For e=e𝗆𝖽 and r{r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖬𝖺𝗑𝖽𝗌𝖼,r𝖲𝗎𝗆,r𝖫𝖾𝗑}, the problem 𝖤𝖷𝖯r,e is 𝖥𝖯#𝖯-hard. This remains true if the entries of 𝐌 are restricted to {0,1} and the distribution Π is the uniform distribution on {0,1}m.

We prove this theorem (in the archive version [33]) via a reduction from counting satisfying assignments to positive CNF formulas. The proof is similar to that of Theorem 12, but with a small twist. Since d𝗆𝖽 is a global measure, we cannot define a matrix 𝐌 where we separate satisfying assignments from non-satisfying ones. Instead, we will define two matrices 𝐌1 and 𝐌2 in a way that the difference of the effect functions allows this distinction.

Lemma 17.

Let ϕ=i=1Di be a positive CNF formula with variable set X1,,Xm and clauses Di=j=1riXji. Then, there exist two matrices 𝐌1(2+1)×m and 𝐌2(2+2)×m with entries in {0,1} and the following property: For each set C of columns and each ranking function r{r𝖬𝖺𝗑𝖺𝗌𝖼,r𝖲𝗎𝗆,r𝖫𝖾𝗑}, we have

d𝗆𝖽(r(𝐌2),r(𝐌2|C))d𝗆𝖽(r(𝐌1),r(𝐌1|C))={0, if α[C]ϕ1, otherwise. (8)

Proof sketch of Lemma 17.

The construction of the matrices is similar to Examples 6 and 14 with more copies of the all-zero tuple, which occupy the top positions whenever the formula is satisfied, yielding zero displacement. Matrix 𝐌2 contains one additional copy of the all-zero tuple compared to 𝐌1, so the two matrices behave similarly, but the maximum displacement in 𝐌2 is higher than that of 𝐌1 by exactly 1 whenever the formula is not satisfied.

6 Exact Computation of the Shapley Value

In this section, we turn our attention to the importance of columns via the Shapley value instead of the importance of scoring parameters via the SHAP score. We will first show that all our algorithms from Section 4 for SHAP score computation can be used to determine Shapley values and then complete the picture by extending our results from Section 5.

Theorem 18.

For the ranking functions r and effect functions e that we introduced in Section 3, computational complexity of 𝖲𝗁𝖺𝗉𝗅𝖾𝗒r,e is the same as the computational complexity of 𝖲𝖧𝖠𝖯r,e given in Table 1.

6.1 Algorithms

Gilad et al. [15] give a simple algorithm based on interpolation that computes Shapley values in polynomial time when having access to an oracle to a special instance of SHAP score computation called 𝖻𝗂𝗇𝖺𝗋𝗒𝖲𝖧𝖠𝖯. Translated into our setting, their result is the following:

Theorem 19 ([15, Theorem 6.15]).

Let r be a ranking function and e be an effect function with the property that for each set C of columns, we have e(r(𝐌|C))=e(r(𝐌𝟙C)). Then, we can solve 𝖲𝗁𝖺𝗉𝗅𝖾𝗒r,e in polynomial time with m oracle calls to 𝖲𝖧𝖠𝖯r,e.

While the condition of the theorem is always true for ranking by 𝖲𝗎𝗆 and 𝖫𝖾𝗑, it does not necessarily hold for 𝖬𝖺𝗑 ranking if 𝐌 contains negative numbers. Fortunately, we can make 𝐌 non-negative by adding the minimal value in 𝐌 to each entry without changing the rankings of each set of columns. Hence, we can use the previous theorem to show that all our algorithms carry other to Shapley value computation.

6.2 Intractable Cases

To show hardness results from Section 5, we reduced the counting knapsack problem (Lemma 10) and the problem of counting satisfying assignments to positive CNF formulas (Lemmas 17 and 14) to SHAP score computation via the equivalence to expectation computation (Theorem 1). Since this equivalence does not hold in general for Shapley value computation, we need an alternative approach to extend our results. Instead, we will define two auxiliary games and show the hardness of Shapley value computation for each of them. The proofs are given in the archive version [33]. They follow the technique that is used for most hardness proofs of Shapley value computation [22, 18]: For a given instance to a game, define a set of related instances and use their Shapley values to count valid knapsack sets or satisfying assignments, respectively, via interpolation.

The first game is the knapsack game: For natural numbers b1,,b and b+1=d given in binary, consider the game with player set [+1] and valuation function ν𝗄𝗇𝖺𝗉 where ν𝗄𝗇𝖺𝗉(C)1 if +1C and iC{}bid, and ν𝗄𝗇𝖺𝗉(C)0 otherwise.

Lemma 20.

Shapley value computation for the players of the knapsack game is 𝖥𝖯#𝖯-hard.

The second game is the positive CNF game: Given a positive CNF formula ϕ with variable set X1,,Xm, consider the game with player set [m] and valuation function ν𝖢𝖭𝖥 where ν𝖢𝖭𝖥(C)1 if α[C]ϕ, and ν𝖢𝖭𝖥(C)0 otherwise.

Lemma 21.

Shapley value computation is 𝖥𝖯#𝖯-hard for the positive CNF game.

With these lemmas and the constructions from Section 5, we can now easily prove Theorem 18. The details are in the archive version of the paper [33].

7 Conclusions

We studied the computational complexity of measuring the importance of parameter choices in ranking functions. Specifically, we investigated the SHAP score of parameters under a collection of specific (yet basic) ranking functions and effect functions. For that, we studied the complexity of calculating the expected effect over random parameter values, focusing on finite and probabilistically independent distributions. We also studied the related problem of computing the Shapley value of columns for measuring their contribution to the ranking.

We view this work as a first step in the rigorous analysis of the complexity of function-based explanations for rankings. As such, many directions are left for future investigation. We would like to generalize our results into broad classes of ranking and effect functions, rather than considering specific cases separately. In particular, we aim to analyze the implication of the different choices made in popular ranking schemes; examples include sports ranking such as WBSC444https://www.wbsc.org/en/rankings and FIFA/Coca-Cola World Ranking,555https://inside.fifa.com/fifa-world-ranking which have the shape of workflow diagrams with linear combinations of features, and the Computer Science Rankings666https://csrankings.org/ that accounts for a pre-determined choice of publication venues. We also want to extend our analysis to other classes of probability distributions, including uniform distributions over intervals, and to characterize the cases where we can efficiently approximate SHAP multiplicatively. Moreover, we would like to understand the complexity of general types of effect functions that include alternatives to those studied here, such as Spearman’s footrule and the Cayley distance.

Finally, an important direction for future research is to study the practicality of the framework in real-life scenarios, and particularly understand how well the attribution functions of SHAP and Shapley capture people’s intuition on the contribution of the components of a ranking function.

References

  • [1] Hadis Anahideh and Nasrin Mohabbati-Kalejahi. Local explanations of global rankings: insights for competitive rankings. IEEE Access, 10:30676–30693, 2022. doi:10.1109/ACCESS.2022.3159245.
  • [2] Avishek Anand, Lijun Lyu, Maximilian Idahl, Yumeng Wang, Jonas Wallat, and Zijian Zhang. Explainable information retrieval: A survey, 2022. doi:10.48550/arXiv.2211.02405.
  • [3] Marcelo Arenas, Pablo Barcelo, Leopoldo Bertossi, and Mikael Monet. On the complexity of shap-score-based explanations: Tractability via knowledge compilation and non-approximability results. Journal of Machine Learning Research, 24(63):1–58, 2023. URL: http://jmlr.org/papers/v24/21-0389.html.
  • [4] Abolfazl Asudeh, H. V. Jagadish, Gerome Miklau, and Julia Stoyanovich. On obtaining stable rankings. PVLDB, 12(3):237–250, 2018. doi:10.14778/3291264.3291269.
  • [5] Alexander Barg and Arya Mazumdar. Codes in permutations and error correction for rank modulation. IEEE Trans. Inf. Theory, 56(7):3158–3165, 2010. doi:10.1109/TIT.2010.20484.
  • [6] Leopoldo E. Bertossi, Benny Kimelfeld, Ester Livshits, and Mikaël Monet. The Shapley value in database management. SIGMOD Record, 52(2):6–17, 2023. doi:10.1145/3615952.361595.
  • [7] Javier Castro, Daniel Gómez, Elisenda Molina, and Juan Tejada. Improving polynomial estimation of the shapley value by stratified random sampling with optimum allocation. Computers & Operations Research, 82:180–188, 2017. doi:10.1016/j.cor.2017.01.019.
  • [8] Zixuan Chen, Panagiotis Manolios, and Mirek Riedewald. Why not yet: Fixing a top-k ranking that is not fair to individuals. PVLDB, 16(9):2377–2390, 2023. doi:10.14778/3598581.3598606.
  • [9] Tanya Chowdhury, Yair Zick, and James Allan. RankSHAP: Shapley value based feature attributions for learning to rank. In ICLR, 2025. URL: https://openreview.net/forum?id=4011PUI9vm.
  • [10] Daniel Deutch, Nave Frost, Benny Kimelfeld, and Mikaël Monet. Computing the Shapley value of facts in query answering. In SIGMOD, pages 1570–1583. ACM, 2022. doi:10.1145/3514221.3517912.
  • [11] Alexandre Duval and Fragkiskos D. Malliaros. GraphSVX: Shapley value explanations for graph neural networks. In ECML/PKDD (2), volume 12976 of LNCS, pages 302–318. Springer, 2021. doi:10.1007/978-3-030-86520-7_19.
  • [12] Martin E. Dyer, Alan M. Frieze, Ravi Kannan, Ajai Kapoor, Ljubomir Perkovic, and Umesh V. Vazirani. A mildly exponential time algorithm for approximating the number of solutions to a multidimensional knapsack problem. Comb. Probab. Comput., 2:271–284, 1993. doi:10.1017/S0963548300000675.
  • [13] Ronald Fagin, Benny Kimelfeld, and Phokion G. Kolaitis. Probabilistic data exchange. J. ACM, 58(4):15:1–15:55, 2011. doi:10.1145/1989727.1989729.
  • [14] Abraham Gale and Amélie Marian. Explaining monotonic ranking functions. PVLDB, 14(4):640–652, 2020. doi:10.14778/3436905.3436922.
  • [15] Amir Gilad, Martin Grohe, Benny Kimelfeld, Peter Lindner, and Christoph Standke. The importance of parameters in database queries, 2024. doi:10.48550/arXiv.2401.04606.
  • [16] Parikshit Gopalan, Adam Klivans, Raghu Meka, Daniel Štefankovic, Santosh Vempala, and Eric Vigoda. An FPTAS for #knapsack and related counting problems. In FOCS, pages 817–826, 2011. doi:10.1109/FOCS.2011.32.
  • [17] Erich Grädel, Yuri Gurevich, and Colin Hirsch. The complexity of query reliability. In PODS, pages 227–234. ACM Press, 1998. doi:10.1145/275487.29512.
  • [18] Martin Grohe, Benny Kimelfeld, Peter Lindner, and Christoph Standke. The importance of parameters in database queries. In ICDT, volume 290 of LIPIcs, pages 14:1–14:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.ICDT.2024.14.
  • [19] Maria Heuss, Maarten de Rijke, and Avishek Anand. RankingSHAP - listwise feature attribution explanations for ranking models, 2024. doi:10.48550/arXiv.2403.16085.
  • [20] Uday Kamath and John Liu. Explainable Artificial Intelligence: An Introduction to Interpretable Machine Learning. Springer, 2021. doi:10.1007/978-3-030-83356-5.
  • [21] Ahmet Kara, Dan Olteanu, and Dan Suciu. From Shapley value to model counting and back. PACMMOD, 2(2):79, 2024. doi:10.1145/3651142.
  • [22] Ester Livshits, Leopoldo E. Bertossi, Benny Kimelfeld, and Moshe Sebag. The shapley value of tuples in query answering. Log. Methods Comput. Sci., 17(3), 2021. doi:10.46298/LMCS-17(3:22)2021.
  • [23] Scott M. Lundberg and Su-In Lee. A unified approach to interpreting model predictions. In NIPS, pages 4765–4774, 2017. URL: https://proceedings.neurips.cc/paper/2017/hash/8a20a8621978632d76c43dfd28b67767-Abstract.html.
  • [24] Lijun Lyu and Avishek Anand. Listwise explanations for ranking models using multiple explainers. In ECIR, volume 13980 of LNCS, pages 653–668. Springer, 2023. doi:10.1007/978-3-031-28244-7_41.
  • [25] Gustavo Penha, Eyal Krikon, and Vanessa Murdock. Pairwise review-based explanations for voice product search. In CHIIR, pages 300–304. ACM, 2022. doi:10.1145/3498366.350582.
  • [26] Venetia Pliatsika, Joao Fonseca, Kateryna Akhynko, Ivan Shevchenko, and Julia Stoyanovich. ShaRP: A novel feature importance framework for ranking, 2024. arXiv:2401.16744.
  • [27] Ariel D. Procaccia, Nisarg Shah, and Yair Zick. Voting rules as error-correcting codes. Artificial Intelligence, 231:1–16, 2016. doi:10.1016/j.artint.2015.10.003.
  • [28] Alvin E. Roth, editor. The Shapley value : essays in honor of Lloyd S. Shapley. Cambridge University Press, 1988. URL: http://www.loc.gov/catdir/samples/cam031/88002983.html.
  • [29] Benedek Rozemberczki, Lauren Watson, Péter Bayer, Hao-Tsung Yang, Olivér Kiss, Sebastian Nilsson, and Rik Sarkar. The Shapley value in machine learning. In IJCAI, pages 5572–5579, 2022. doi:10.24963/ijcai.2022/778.
  • [30] Sourav Saha, Debapriyo Majumdar, and Mandar Mitra. Explainability of text processing and retrieval methods: A critical survey, 2022. doi:10.48550/arXiv.2212.07126.
  • [31] Lloyd S Shapley. A value for n-person games. In Harold W. Kuhn and Albert W. Tucker, editors, Contributions to the Theory of Games II, pages 307–317. Princeton University Press, Princeton, 1953. doi:10.1515/9781400829156-012.
  • [32] Jaspreet Singh and Avishek Anand. Model agnostic interpretability of rankers via intent modelling. In FAT*, pages 618–628. ACM, 2020. doi:10.1145/3351095.33752.
  • [33] Christoph Standke, Nikolaos Tziavelis, Wolfgang Gatterbauer, and Benny Kimelfeld. The importance of parameters in ranking functions, 2026. arXiv:2601.06001.
  • [34] Seinosuke Toda and Mitsunori Ogiwara. Counting classes are at least as hard as the polynomial-time hierarchy. SIAM J. Comput., 21(2):316–328, 1992. doi:10.1137/0221023.
  • [35] Leslie G Valiant. The complexity of enumeration and reliability problems. SIAM Journal on Computing, 8(3):410–421, 1979. doi:10.1137/0208032.
  • [36] Guy Van den Broeck, Anton Lykov, Maximilian Schleich, and Dan Suciu. On the tractability of SHAP explanations. Journal of Artificial Intelligence Research, 74:851–886, June 2022. doi:10.1613/jair.1.13283.
  • [37] Ke Yang, Julia Stoyanovich, Abolfazl Asudeh, Bill Howe, HV Jagadish, and Gerome Miklau. A nutritional label for rankings. In SIGMOD, pages 1773–1776, 2018. doi:10.1145/3183713.319356.
  • [38] Puxuan Yu, Razieh Rahimi, and James Allan. Towards explainable search results: A listwise explanation generator. In SIGIR, pages 669–680. ACM, 2022. doi:10.1145/3477495.3532067.