TL;DR
While SHapley Additive exPlanations (SHAP) is a gold standard for interpreting deep learning models, its results can be surprisingly "jittery" depending on the reference data provided. This study reveals that increasing the background dataset size significantly stabilizes both individual feature contributions and overall variable rankings, particularly for the most and least important features.
The Problem: The "Jitter" in SHAP Explanations
To explain a complex model like an Artificial Neural Network (ANN), the SHAP framework—specifically the DeepExplainer—requires a "background dataset." This dataset acts as a reference point, representing the "average" or "expected" input against which a specific instance is compared.
The official documentation suggests using 100 random samples, but researchers often use varying sizes without a clear rationale. This paper addresses a critical gap: How does the size of this background dataset affect the stability of the explanations? If you run SHAP twice with different random background samples, will you get the same answer? The authors found that with small background sets, both individual SHAP values and global feature rankings fluctuate significantly, potentially undermining trust in the model's interpretability.
Methodology and Datasets
The authors conducted an empirical study using a three-layer ANN trained on a de-identified Intensive Care Unit (ICU) dataset from the Beth Israel Deaconess Medical Center (MIMIC-III). The dataset included 44,918 admission episodes, using 15 clinical variables (like heart rate, blood pressure, and glucose) to predict patient mortality.
They varied the background dataset size ($m$) from 100 to 1,000 and ran 100 simulations for each size to observe how much the results changed. To measure "stability," they used three distinct metrics:
- Statistical Variance: To see how much individual SHAP values for a single prediction fluctuated.
- Quartile-based BLEU Score: Borrowed from machine translation, this measured the exact order stability of feature rankings.
- Quartile-based Jaccard Index: Used to measure "fuzzy" stability—checking if the same group of features stayed in the same importance tier, even if their exact internal order shifted.
Key Insights and Results
Visualizing Stability
The most striking evidence of this instability is visual. At smaller background sizes, the rankings of variables across different runs are fragmented and noisy. As the background size increases, these rankings solidify.
Exact vs. Fuzzy Ranking Stability
The authors found that as the background dataset size increases, it converges to the true distribution of the training data. This reduces randomness and leads to more representative explanations.
- Variance Reduction: The variance sum per variable decreased sharply as $m$ increased. For example, the variance for Systolic Blood Pressure dropped from 271.31 ($m=100$) to 24.13 ($m=1000$).
- Ranking Stability: The exact ranking of variables (measured by BLEU) improved significantly, jumping from an average of 0.432 at $m=100$ to 0.644 at $m=1000$.
Interestingly, even at a background size of 1,000, the exact ranking of variables didn't perfectly stabilize. However, the membership of variables in importance groups (measured by the Jaccard index) was quite stable, improving from 0.868 to 0.924.
The "U-Shape" Stability
One of the most fascinating findings is that SHAP is most reliable at the extremes. It is very consistent at identifying the most important and least important variables. The "middle" variables (those with moderate importance) are the ones most prone to swapping ranks when the background data changes.
Limitations and Practical Takeaways
While this study provides crucial insights, it focused on a relatively simple three-layer ANN and a single medical dataset. Results might differ for much deeper architectures (like CNNs or Transformers) or different data types. Furthermore, computational complexity scales linearly with the background data size; doubling your background samples roughly doubles your computation time.
The Practical Tip: Run a pilot experiment. Use a small background set (e.g., 100) to estimate the time cost, then scale up to the largest background size your computational budget allows. This ensures your SHAP explanations are as stable and trustworthy as possible.
Summary updated