---
title: 'Partition SHAP: Group-wise Model Explanations'
url: https://www.emergentmind.com/topics/partition-shap
type: topic
---

# Partition SHAP: Group-wise Model Explanations

Partition SHAP refers to a rigorous class of Shapley-value-based model explanation methods that assign attributions not only to individual features, but to partitions—i.e., blocks or groups—of features, often to capture interaction effects, manage computational complexity, or align with structured data types. Partition SHAP methods include frameworks such as PartitionSHAP for interaction-aware explanations, mSHAP for two-part (multiplicative) models, and window-based partitioning for time series. Their key innovation is to yield interpretable, locally-accurate, and sometimes interaction-aware additive explanations of black-box model predictions, spanning high-dimensional and structured modalities [2402.05566], [2106.08990], [2211.06507]. These approaches generalize classical SHAP, with the goal of retaining efficiency, interpretability, and fidelity in settings where classical, feature-wise SHAP is inadequate.

## 1. Mathematical Foundations of Partition SHAP

Partition SHAP is grounded in the Shapley value from cooperative game theory, extended to operate on groups ("blocks") of features. Consider a black-box model $f : \mathbb{R}^d \to \mathbb{R}$ and a particular observation $x \in \mathbb{R}^d$. Instead of only attributing model output to atomic features, Partition SHAP seeks an explanation in terms of a partition $\Pi = \{S_1, S_2, \dots, S_m\}$ of the feature indices: each $S_i \subseteq [d]$, $S_i \cap S_j = \emptyset$ for $i \neq j$, and $\bigcup_i S_i = [d]$.

A value function $v: 2^{[d]} \to \mathbb{R}$ quantifies the model output when a feature subset $S$ is "present" (e.g., $v(S) = \mathbb{E}[f(X) | X_S = x_S]$). The additive surrogate explanation takes the form
\[
\hat{f}_\Pi(x) = \sum_{S \in \Pi} v(S) \approx f(x)
\]
where each term $v(S)$ captures both main effects and interactions within block $S$ [2402.05566]. The quality of a partition is then measured by a reconstruction error $E(\Pi) = (f(x) - \sum_{S \in \Pi} v(S))^2$ and a complexity penalty $C(\Pi) = \sum_{S \in \Pi} \frac{|S|(|S|-1)}{2}$, which counts the number of explicit pairwise interactions within each block.

Partition SHAP thus generalizes atomic-feature SHAP explanations, subsuming both single-feature and set-based (e.g., nSHAP) explanations, but with a succinctness constraint imposed via penalization of block size and number [2402.05566].

## 2. Algorithms and Statistical Pruning for Partition Discovery

The central computational challenge is to select the partition $\Pi$ that yields an interpretable, representative, and succinct surrogate. In PartitionSHAP [2402.05566], this is formalized as the optimization
\[
\Pi^* = \arg\min_{\Pi} \, \left\{E(\Pi) + \lambda C(\Pi)\right\}
\]
for regularization parameter $\lambda \ge 0$.

To manage the super-exponential search space of partitions, PartitionSHAP employs a statistical interaction test. For each pair of features $i, j$, an interaction index
\[
I(i, j \mid S) = v(S \cup \{i\}) + v(S \cup \{j\}) - v(S \cup \{i, j\}) - v(S)
\]
is averaged over randomly sampled contexts $S \subseteq [d] \setminus \{i, j\}$. Pairs with statistically significant interaction (by Welch's $t$-test at level $\alpha$) are joined via an edge in an interaction graph $G$. Only partitions in which each block forms a connected subgraph in $G$ are considered. This pruning dramatically shrinks the search space.

Partition search is conducted by exact enumeration for $d \lesssim 15$, or a greedy bottom-up merge: iteratively join blocks that most reduce objective, restricted to merges allowed by $G$. Complexity is $O(d^4)$ for greedy search, with further gains from cached value functions and graph sparsity [2402.05566].

## 3. Partition SHAP in Structured Domains: Time Series and Multiplicative Models

Partition SHAP generalizes naturally to domains exhibiting structure or locality, such as time series and two-part models.

**WindowSHAP for Time Series:** [2211.06507]
For time series $X \in \mathbb{R}^{D \times L}$, treating each variable–timepoint pair as a feature is computationally intractable. WindowSHAP partitions the sequence into windows (fixed or adaptive), treats each window as a player, and computes Shapley values for these blocks. Three partitioning strategies are outlined:

- **Stationary:** Non-overlapping windows of fixed length. Complexity drops from $O(2^{DL})$ to $O(2^{D L/\ell})$, with window length $\ell$ controlling the tradeoff.
- **Sliding:** Overlapping windows, aggregating attributions for points occurring in multiple windows.
- **Dynamic:** Successively subdivides windows with high attributions, focusing resolution adaptively.

Atomic-level attributions are recovered by uniform redistribution of window-level SHAP values. This method satisfies local accuracy and Shapley axioms at the partition level.

**mSHAP for Two-Part Models:** [2106.08990]
In multiplicative models $f(x) = f_1(x) \cdot f_2(x)$, each $f_i$ has its own SHAP decomposition. Direct computation of SHAP for $f$ is intractable; mSHAP constructs feature contributions by expanding the product algebraically, collecting main and cross-terms, and applying a bias correction for empirical-mean discrepancy. Simulation shows mSHAP approximates kernelSHAP closely but is orders of magnitude faster.

## 4. Empirical Studies and Applications

Experiments on synthetic and real data demonstrate the practical advantages of Partition SHAP methods.

### Representative Results

| Scenario                       | Method              | Fidelity ($R^2$) | Runtime  | Interpretability |
|---------------------------------|---------------------|------------------|----------|-----------------|
| Bikesharing (10 features)       | PartitionSHAP       | High             | Seconds  | Compact, blocks |
| COVID-19 Survival               | PartitionSHAP       | High             | Seconds  | Explicit inter. |
| Time series (D=62, L=120)       | WindowSHAP          | High             | $\downarrow$80% CPU | Window groups   |
| Auto insurance (20M samples)    | mSHAP               | Local accuracy   | Scales to 20M | Splits freq/sev |

PartitionSHAP outperforms nSHAP and SHAP in F1 score for recovering true interacting feature blocks and obtains high surrogate fidelity ($R^2 > 0.9$) in linear and nonlinear model families [2402.05566]. WindowSHAP demonstrates superior performance in perturbation metrics compared to kernelSHAP and TimeSHAP, doubling the loss increase upon perturbation of top-attributed time windows in RNN clinical models, while reducing computation by over 80% [2211.06507]. mSHAP achieves close agreement in sign and rank with kernelSHAP at a fraction of the cost [2106.08990].

## 5. Interpretability, Complexity, and Tradeoffs

Partition SHAP methods explicitly balance explanation fidelity with complexity, formalized by the penalization of allowed interactions. Blocks with many features yield fewer terms but increase explanation complexity; singletons reduce interactions but may miss key effects. The optimal partition trades off these concerns, modulated by $\lambda$. Statistical interaction testing ensures that blocks represent genuine dependencies, not spurious co-influence.

Uniform redistribution of block-level attributions (as in WindowSHAP) preserves local accuracy but may obscure within-group heterogeneity—a plausible implication is that partition granularity should be tuned to the application and validation metrics.

## 6. Related Approaches and Theoretical Properties

Partition SHAP encompasses and generalizes special cases:

- **Group-SHAP:** Treats pre-defined feature groups as units, without adaptively optimizing the partition.
- **nSHAP:** Reports all $2^d$ subset attributions, but leads to exponentially sized outputs.
- **TimeSHAP:** Prunes or groups early history in time-series under heuristic assumptions about irrelevance; WindowSHAP generalizes by allowing arbitrary, possibly adaptive, partitions.

Partition SHAP retains the local accuracy, efficiency, symmetry, and linearity properties of the original Shapley framework at the partition level, as exact Shapley values are computed on the partitioned player set [2211.06507], [2402.05566].

## 7. Implementation, Scalability, and Further Directions

Implementations of Partition SHAP methods are available for specific domains, notably the "mshap" R package for mSHAP [2106.08990]. PartitionSHAP's greedy merge algorithm handles hundreds of features within seconds; exact enumeration is feasible for $d \leq 15$ [2402.05566]. In time-series settings, appropriate window length or block size must be tuned to balance computational efficiency and explanatory resolution.

A plausible implication is that Partition SHAP methodology is applicable to other structured domains with feature correlations or hierarchical organizations (e.g., images, graphs). The current statistical pruning approach could be extended to non-pairwise interactions, or to causal value functions. Validation by task-specific perturbation metrics remains essential to ensure explanations reflect the underlying model dependence structure.

Source: https://www.emergentmind.com/topics/partition-shap