Abstract
Shapley values have become the standard tool for explaining predictions in tree ensemble models. However, Banzhaf values—a closely related power index from game theory—have remained relatively under-explored in the machine learning community. This paper provides a comprehensive theoretical and experimental comparison of these two methods. We demonstrate that Banzhaf values offer significant advantages over Shapley values, including more intuitive interpretations, superior numerical robustness, and significantly more efficient algorithms. We introduce a new algorithm for computing Shapley values in $O(TLD + n)$ time, improving upon the previous $O(TLD^2 + n)$ state-of-the-art. Furthermore, we present an optimal $O(TL + n)$ algorithm for Banzhaf values. Our experiments on real-world and synthetic datasets show that Banzhaf values provide essentially the same feature importance rankings as Shapley values while being up to an order of magnitude faster to compute.
Introduction
As machine learning models are increasingly deployed in high-stakes environments such as healthcare and finance, the ability to explain specific predictions is critical. For tree ensemble models like XGBoost, LightGBM, and Random Forests, the gold standard for feature attribution is the Shapley value, popularized by the SHAP framework.
Despite their popularity, Shapley values suffer from three primary drawbacks: high computational complexity, a somewhat unintuitive mathematical definition based on permutations, and catastrophic numerical instability when applied to deep decision trees. This research investigates whether Banzhaf values can serve as a faster, more robust, and more intuitive drop-in replacement for Shapley values in tree-based interpretability.
Methodology and Algorithmic Contributions
The core contribution of this work lies in the development of more efficient algorithms for both Shapley and Banzhaf values by optimizing the dynamic programming approach used in tree ensembles.
1. Improved Shapley Computation
The previous state-of-the-art algorithm for tree ensembles, TreeSHAP, operates in $O(TLD^2 + n)$ time, where $T$ is the number of trees, $L$ is the maximum number of leaves, $D$ is the maximum depth, and $n$ is the number of features. By optimizing the dynamic programming state transitions to compute leaf contributions simultaneously, we reduce the complexity to $O(TLD + n)$, effectively removing a factor of $D$.
2. Optimal Banzhaf Computation
Banzhaf values are mathematically simpler than Shapley values because their definition does not depend on the specific size of the feature subset in the same combinatorial way. Leveraging this simplicity, we adapted our optimized dynamic programming framework to achieve an asymptotically optimal $O(TL + n)$ time complexity for Banzhaf values.
3. Theoretical Equivalence
To justify the switch from Shapley to Banzhaf, we provide a theoretical foundation showing that for monotone functions on a uniform hypercube, both methods yield identical global feature impact rankings. This suggests that practitioners do not lose explanatory power by choosing the more efficient Banzhaf method.
Experimental Evaluation
We evaluated the proposed algorithms using a variety of real-world datasets (BOSTON, NHANES, HEALTH_INSURANCE, and FLIGHTS) and synthetic datasets designed to test the limits of numerical precision.
Speed and Efficiency
The performance gains were most evident on large-scale datasets. On the FLIGHTS dataset using a deep Decision Tree, the original Shapley implementation required over 5 hours to complete. Our improved Shapley algorithm (shap_fast) reduced this to approximately 1.75 hours, while the Banzhaf algorithm (ban) completed the task in just 14.5 minutes. This represents an order-of-magnitude improvement in computational efficiency.
Numerical Robustness
A critical finding of this research is the numerical fragility of Shapley values. Because Shapley computations involve dividing by large combinatorial terms, floating-point errors compound exponentially in deep trees. In our tests with synthetic sparse trees, standard Shapley implementations produced unusable results once tree depth exceeded 50. In contrast, Banzhaf values avoid these complex fractions and remained numerically stable regardless of tree depth.
Ranking Consistency
Across all Gradient Boosting Decision Tree (GBDT) models tested, the top 20 most important features identified by Banzhaf and Shapley values were virtually identical. This confirms that Banzhaf values provide the same practical insights into model behavior as Shapley values, but with much lower overhead.
Discussion and Conclusion
While global feature importance aligns closely between the two methods, we observed that local explanations for individual data points can diverge in very deep trees. However, much of this divergence is attributable to the numerical failures of the Shapley computation rather than a flaw in the Banzhaf approach.
In conclusion, Banzhaf values offer a compelling alternative to Shapley values for tree model interpretability. They are faster to compute, more stable in deep architectures, and offer a more straightforward probabilistic interpretation: "What is the expected change to the model's output if this feature is added?" We recommend that standard interpretability libraries integrate Banzhaf values as a high-performance default for tree-based ensembles.
Summary updated