Abstract
SHAP (Shapley Additive Explanations) is frequently used to determine global feature importance by averaging local attributions. However, this common practice lacks theoretical soundness: a model can depend heavily on a feature that nonetheless yields an aggregate SHAP value of zero. This paper identifies this "blind spot" and introduces a mathematically sound modification. By aggregating SHAP values over an "extended support"—constructed by randomly shuffling data columns—practitioners can ensure that low importance scores truly justify discarding a feature. We provide theoretical guarantees for this approach using a novel framework called the Shapley Lie algebra.
Introduction
In the effort to "open the black box" of machine learning, SHAP has emerged as the industry standard. While originally designed for local explanations (explaining individual predictions), it is increasingly used for global feature selection. Practitioners typically calculate the mean absolute SHAP value for each feature across a dataset; if the value is near zero, the feature is deemed unimportant and removed to simplify the model.
This paper reveals that this heuristic is dangerously flawed. We demonstrate that it is possible for a model to be functionally dependent on a feature while its aggregate SHAP value remains zero across the entire observed data distribution. This occurs because SHAP evaluates models on synthetic points that may lie outside the actual data support. If a model behaves erratically in these "empty" regions, it can effectively mask the feature's true importance.
The SHAP Blind Spot
The core of the problem lies in SHAP's use of "interventional" value functions. To calculate an attribution, SHAP probes the model by toggling features on and off. This process often requires evaluating the model at coordinates that never appear in the training set. If a model is strategically designed—or simply poorly regularized—in these off-manifold regions, the resulting SHAP values can cancel each other out or vanish entirely, even if the feature is critical for predictions on the actual data manifold.
This lack of "soundness" means that discarding features based on standard aggregate SHAP can lead to the accidental removal of predictive variables, potentially degrading model performance and reliability.
Proposed Method: Sound Aggregation
To resolve this masking issue, we propose three primary contributions that transform SHAP into a reliable tool for feature selection.
1. Extended Support
Instead of calculating SHAP only on observed data points, we propose using the "extended support." This is defined as the product of the marginal distributions of each feature. By forcing the SHAP calculation to consider combinations of features that might not exist in the training set but fall within the valid range of individual features, we ensure the explainer "sees" the model's full functional dependence.
2. The Permutation Trick (Algorithm 1)
We provide a practical implementation called Sound Aggregate KernelSHAP. This method does not require specialized software; rather, it involves a simple data preprocessing step. By randomly permuting each column of the data matrix, practitioners create a sample from the extended distribution. Calculating KernelSHAP on this shuffled data provides a "sound" importance score where a zero value mathematically implies feature irrelevance.
3. The Shapley Lie Algebra
On the theoretical front, we introduce the Shapley Lie algebra. By treating SHAP as a system of linear operators and applying tools from Lie Theory, we prove that our proposed method is guaranteed to identify irrelevant features. This framework allows us to move beyond mere approximation and establish formal requirements for model interpretability.
Key Theoretical Results
Our findings are anchored by several key theorems that provide the first formal guarantees for the KernelSHAP algorithm:
- Theorems 6 & 11: We prove that if the aggregate SHAP value over the extended support is zero, the feature is mathematically guaranteed to be irrelevant to the model's output. If the value is small, the feature's impact is boundedly small.
- Theorem 12: We extend these results specifically to KernelSHAP, the most common implementation of SHAP. This provides a theoretical safety net for the actual code used by thousands of data scientists.
Discussion and Limitations
While our method ensures soundness, it introduces a trade-off in computational cost. Sampling from the extended support requires more data points to achieve stable estimates compared to sampling from the original distribution. This may increase the time required for generating explanations in high-dimensional settings.
Furthermore, our approach is strictly model-centric. It identifies whether the model uses a feature, regardless of whether that feature is useful in a causal or data-centric sense. We argue that for scientific discovery and model auditing, knowing exactly what the model has learned is the primary objective.
Conclusion
The common practice of averaging SHAP values for feature selection is not inherently safe. However, by adopting the "extended support" approach and the permutation trick, practitioners can turn SHAP into a sound instrument for dimensionality reduction. Our work provides the mathematical foundation necessary to trust that when a feature's aggregate SHAP is zero, it is truly safe to discard.
Summary updated