Shapley Modes in Structured Data
- Shapley Modes are computational strategies that partition model outputs into main effects and interactions for structured data.
- L-Shapley approximates contributions by considering local neighborhoods, reducing complexity while capturing short-range feature impacts.
- C-Shapley focuses on connected subgraphs to efficiently reflect contextual and interpretable attributions in applications like NLP and image processing.
Shapley Modes refer to computational and conceptual strategies for efficiently and faithfully partitioning model outputs among features and their interactions, particularly in complex or structured data domains. The term encompasses both algorithmic approximations designed to handle the exponential complexity of exact Shapley value computation, and generalized methods for decomposing model influence into modes—such as main effects, local interactions, and global interactions—often taking into account structural and statistical properties of the data or the modeling task.
1. Foundations: Shapley Values and Structured Data
The classical Shapley value from cooperative game theory attributes the prediction of a model to each input feature by averaging the marginal contribution of that feature across all possible feature subsets. This method enjoys strong fairness properties but is hampered in high-dimensional settings by its exponential computational cost.
When data are structured—for instance, when features correspond to nodes in a sequence (such as words in a sentence) or in a spatial grid (such as pixels in an image)—computing all possible interactions (coalitions) among features is infeasible. In such settings, Shapley Modes are instantiated by two main algorithmic approaches:
- L-Shapley (Local Shapley): Approximates the Shapley value by considering only a local neighborhood around each feature, as defined by the underlying feature graph. Marginal contributions are averaged only over subsets within this neighborhood.
- C-Shapley (Connected Shapley): Further restricts the subset enumeration to only connected subgraphs within the local neighborhood, meaning that, for instance, only contiguous n-grams in sequences or pixel patches in images are considered.
The C-Shapley method is mathematically equivalent to the Myerson value, an extension of the Shapley value for graph-restricted (network) games that respects the locality or connectivity constraints intrinsic to the data.
2. Algorithmic Methodology and Complexity
Shapley Modes address the computational challenge of Shapley value estimation by:
- Exploiting the locality of feature interactions in structured data, justified by the empirical observation and theoretical assumption that distant or disconnected features contribute negligibly or additively and can thus be omitted with small approximation error.
- L-Shapley achieves a complexity of for features and a -hop local neighborhood, which is nearly linear for moderate and large .
- C-Shapley reduces computational cost further to on line graphs and similarly tractable forms on grid graphs, by focusing only on connected local subsets.
Workflow:
- For each instance and each feature, enumerate relevant neighborhood subsets.
- For each subset, evaluate the model and compute the marginal contribution of the feature.
- Aggregate these contributions, weighting appropriately, to obtain the importance score for the feature.
This approach renders per-instance, high-dimensional Shapley-style attributions feasible in practical settings, such as NLP or vision models with hundreds or thousands of features.
3. Graph-Structured Factorization and Theoretical Guarantees
Shapley Modes rest on assumptions about the locality of feature interactions. In graph-structured data, the model's dependence on a feature given its local context is typically dominant, and dependence on distant features is minimal. This is formalized as a graph-structured factorization of the conditional distribution of the target given the features.
Approximation guarantees are given: if the conditional dependence between a feature and distant/disconnected features (given its local neighborhood and optionally the response variable) is small, the error between the approximated Shapley score and the true score is tightly bounded and scales with this dependence (see Theorems 1 and 2 in the source). Thus, under mild conditions, L-Shapley and C-Shapley offer accurate approximations to the true Shapley decomposition.
4. Empirical Comparison and Interpretability
Empirical evaluations across NLP and CV tasks situate L-Shapley and C-Shapley against algorithms such as KernelSHAP (regression-based), SampleShapley (sampling-based), and LIME (local linear approximations):
- In text classification (CNNs, LSTMs), both L-Shapley and C-Shapley perform competitively or superiorly in drop-in-class log-odds when masking key words, with C-Shapley especially excelling in capturing longer-range or structured interactions (e.g., in LSTMs), and L-Shapley better capturing short-range effects (e.g., in CNNs).
- In image classification, C-Shapley delivers more localized and interpretable attribution maps (key pixels or patches), outperforming existing sampling-based, regression-based, and gradient-based saliency methods.
The visual outputs from Shapley Modes closely match human intuitions—highlighting context-specific negations or sentiment words in text and semantically meaningful regions in images.
5. Mathematical Formalism
The general marginal contribution for feature within subset is:
with reflecting the importance of subset (e.g., model output with only present). The classical Shapley value aggregates these across all possible , but L-Shapley and C-Shapley restrict to the local neighborhood or connected subsets, respectively. Exact formulas for these modes are:
- L-Shapley (Definition 1):
- C-Shapley (Definition 2):
where is the -hop neighborhood, and denotes the set of connected -containing subsets in that neighborhood.
6. Applications and Implications
Shapley Modes find application in:
- NLP: Elucidating the local and structured impact of tokens or n-grams in sentiment or topic classification.
- Computer Vision: Isolating spatially-relevant regions in images for model decision-making.
- General Structured Domains: Genomics, time-series analysis, and social networks—where explicit locality or connectivity governs data-dependent interactions.
Beyond scalability, Shapley Modes align model explanations with human reasoning by focusing on locally-relevant reasoning, facilitate compositional or layered interpretability (e.g., pixel patches or word n-grams), and support combining with random sampling or regression-based approximations for broader speed-accuracy tradeoffs.
7. Theoretical and Conceptual Impact
The formal connection between C-Shapley and the Myerson value situates Shapley Modes within the established mathematical theory of graph-restricted cooperative games. Their convergence properties further provide a rigorous foundation for their use in explainability, establishing error bounds under realistic structural assumptions.
By partitioning model predictions into contributions arising from distinct local or connected neighborhoods—what may be viewed as "modes" of feature importance—these techniques offer a principled, fair, and resource-efficient framework for structured model interpretation.
Summary Table: L-Shapley, C-Shapley, and Classical Shapley
Method | Subsets Considered | Complexity per Instance | Best Use-Case |
---|---|---|---|
Classical | All subsets | Exponential () | Small , unstructured |
L-Shapley | Local neighborhoods | (linear-in-) | Local graphs/sequences |
C-Shapley | Connected within neighbors | (linear-in-) | Structured graphs/images |
In all, Shapley Modes—via L-Shapley and C-Shapley—enable scalable, interpretable, and context-aware feature attribution, rooted in game-theoretic fairness but engineered for the challenges of modern, structured machine learning.