TL;DR
The authors introduce Q-SHAP, a novel polynomial-time algorithm designed to calculate global feature contributions ($R^2$ decomposition) under quadratic losses in tree ensemble models. By leveraging the internal structure of decision trees and polynomial identities, Q-SHAP bypasses the exponential complexity of traditional Shapley value calculations, delivering massive speedups and superior accuracy over existing sampling-based methods.
What Problem Does This Paper Address?
While local interpretability tools like TreeSHAP excel at explaining individual machine learning predictions, many real-world applications require a global understanding of feature importance across an entire dataset. A popular framework for global importance is model variance decomposition, specifically individualizing the coefficient of determination ($R^2$).
However, calculating global Shapley values for quadratic losses (like $R^2$) is notoriously difficult. Because it requires evaluating model performance across every possible combination of features, the computational complexity scales exponentially ($2^p$) with the number of features ($p$). Existing model-agnostic alternatives, such as SAGE and SPVIM, rely on Monte Carlo sampling to approximate these values. Unfortunately, permutation sampling is computationally heavy, prone to high variance, and struggles to scale to high-dimensional datasets.
Methods
To overcome the exponential bottleneck, the authors propose Q-SHAP. The core mathematical insight lies in breaking down the quadratic loss function into linear and quadratic terms of the predicted values. While the linear terms can be handled by existing fast SHAP variants, the quadratic terms ($m^2_F$) require a brand-new approach.
Instead of treating the tree ensemble as a black box, Q-SHAP exploits the structural properties of decision trees:
- Leaf-Pair Aggregation: The algorithm proves that the difference in feature subsets can be summarized by looking at pairs of leaf nodes rather than iterating through all feature combinations.
- Polynomial Identity & IFFT: The authors map the subset combination problem to operations on polynomial coefficients. They utilize the Inverse Fast Fourier Transform (IFFT) to evaluate these polynomial dot products with high numerical stability and speed.
The resulting time complexity per tree is $O(L^2 D^2)$ (where $L$ is the number of leaves and $D$ is the maximum tree depth). Crucially, this complexity is entirely independent of the total number of features $p$, allowing it to scale effortlessly to high-dimensional data.
Datasets
The algorithm was validated using both synthetic and real-world datasets:
- Synthetic Data: Three distinct generative models (linear, interaction, and multi-way non-linear interactions) with feature dimensions up to $p=500$ and sample sizes up to $n=5000$.
- Healthcare Insurance Expenses: A small dataset containing 8 features across 1,338 subjects.
- Prostate Cancer Dataset: A high-dimensional genomics dataset containing expression levels of 17,261 genes for 551 samples, used to predict cancer-indicating Gleason scores.
- S&P 500 Stock Data: Financial data tracking 469 stock prices over 1,258 business days to predict the daily return rate of NVIDIA.
Key Insights and Ideas
- Breaking the Dimension Curse: The most significant "aha" moment is that global feature importance for tree models doesn't have to depend on the number of features. By shifting the problem from feature space to tree-structure space, Q-SHAP makes global $R^2$ decomposition practical for ultra-high-dimensional problems like genomics.
- Analytical Exactness vs. Sampling Variance: Sampling-based methods (SAGE, SPVIM) introduce random noise and estimation bias because they only look at a subset of permutations. Q-SHAP computes exact tree-level expectations analytically, leading to highly stable, zero-bias baseline evaluations for nuisance features.
Key Results
- Orders-of-Magnitude Speedups: In simulations with 100 features, Q-SHAP ran hundreds of times faster than SAGE and SPVIM. When scaled to 500 features, Q-SHAP finished in seconds, while competing methods either ran out of memory (2GB limit) or timed out after 4 hours.
- Higher Accuracy: Q-SHAP consistently achieved lower Mean Absolute Error (MAE) and lower estimation bias across various sample sizes and noise levels compared to SAGE and SPVIM.
- Real-World Scalability: On the high-dimensional Prostate and S&P 500 datasets (reconstructed with the top 100 features), Q-SHAP computed feature-specific $R^2$ values in 128 seconds and 41 seconds, respectively. In comparison, SAGE took up to 26 hours, and SPVIM required up to 138 hours.
Limitations and Future Work
The primary limitation of Q-SHAP is its strict mathematical dependency on quadratic loss functions (such as Mean Squared Error and $R^2$). It cannot be directly applied out-of-the-box to classification tasks using log-loss or other non-quadratic objectives.
The authors note that extending this exact polynomial-time framework to more general loss functions remains an open challenge, though approximating arbitrary loss functions via Taylor expansions could be a promising direction for future research.
Summary updated