SHAPIQ (2024)#
SHAPIQ is a Python library designed for computing and analyzing Shapley Interactions (SIs) of any order, which can reveal synergies and redundancies between entities in machine learning tasks. It provides a general interface for state-of-the-art SI algorithms, an explanation API for interpreting model predictions using SIs, and tools for benchmarking and visualizing these interactions across various machine learning domains, offering a more comprehensive understanding of feature relationships than traditional Shapley Values.
Cooperative Game with Three Players#
Consider a cooperative game with three players. So, set \(N = \{1, 2, 3\}\). And let the value function \( v(S) \) define the payout for each possible coalition \(S \subseteq N\). So the possible combinations for the game are as follows:
Order 0 interactions: \( \{\} \)
Order 1 interactions: \( \{1\}, \{2\}, \{3\} \)
Order 2 interactions: \( \{1, 2\}, \{2, 3\}, \{1, 3\} \)
Order 3 interactions: \( \{1, 2, 3\} \)
With SHAPIQ, we are interested in the calculation of interactions like these: \( \{1, 2\}, \{2, 3\}, \{1, 3\}, \{1, 2, 3\} \).
Interaction Index Representation#
Interaction Index is represented by:
Here,
Interaction Index Calculation for \( \{1, 2\} \)#
Here, the possible cases of \(T\) are \(\{\}\) and \(\{3\}\).
So,
Discrete Derivative Calculation#
Possible values for \(L\) are \(\{\}, \{1\}, \{2\}, \{1, 2\}\).
For \( \Delta_{\{1, 2\}}(\{3\}) \):
Final Interaction Index Formula#
Value Function Definition#
Now, we need to get the values from the value function for the terms: \( v(\{\}), v(\{1\}), v(\{2\}), v(\{3\}), v(\{1, 2\}), v(\{2, 3\}), v(\{1, 3\}), v(\{1, 2, 3\}) \).
Here, \(v\) is the value function representing the worth of a coalition (e.g., the model’s prediction with a subset of features).
\(v(\{\})\): The value for the empty coalition, meaning it holds the value when no features are added. This is the model’s base value or the prediction without any feature information.
For any other coalition \(v(\{S\})\), it is obtained by evaluating the model (or its conditional expectation) on the input where only the features in \(S\) are present, and other features are handled (e.g., by marginalization or conditioning).