From global to local MDI variable importances for random forests and when they are Shapley values

Antonio Sutera, Gilles Louppe, Vân Anh Huynh-Thu, Louis Wehenkel, Pierre Geurts

Introduction

Random Forests are widely celebrated for their predictive robustness and their ability to provide feature importance scores via the Mean Decrease of Impurity (MDI). However, MDI has traditionally been viewed as a "heuristic" measure of global importance, lacking the rigorous theoretical foundation of game-theoretic methods like Shapley values. Furthermore, as the demand for explainable AI (XAI) grows, the need for local, instance-level explanations has become paramount.

This research bridges the gap between the heuristic nature of Random Forests and the formal rigor of Cooperative Game Theory. The authors prove that under specific conditions, MDI is mathematically equivalent to a Shapley value and introduce "Local MDI"—a computationally efficient method for generating instance-level explanations.

Theoretical Foundation: MDI as a Shapley Value

The core contribution of this paper is the theoretical link between MDI and the Shapley value, a method for fairly distributing a "payout" among players in a cooperative game.

In the context of Random Forests, the authors consider a "categorical setting" using Shannon entropy and exhaustive splits. They prove that when trees are totally randomized, the global MDI of a feature is exactly its Shapley value, where the "game" is defined as the mutual information between the features and the output. This finding elevates MDI from a clever trick to a mathematically grounded attribution method.

Introducing Local MDI

While global MDI tells us which variables are important for the model overall, it cannot explain why a specific prediction was made. To solve this, the authors propose Local MDI.

Definition and Mechanism

Global MDI sums impurity decreases across all nodes in a forest. In contrast, Local MDI only sums the impurity decreases along the specific paths traversed by a single data instance $x$.

  • Theoretical Link: Local MDI is shown to be a Shapley value that decomposes the reduction in uncertainty (entropy) for a specific instance.
  • Computational Efficiency: Unlike model-agnostic methods like SHAP, which often require thousands of model re-evaluations, Local MDI is a "by-product" of the tree structure. It can be calculated during the standard prediction pass with virtually zero additional overhead.

Key Characteristics

One notable finding is that while global MDI is always non-negative, Local MDI can be negative. This occurs if a specific feature split actually increases uncertainty for a particular instance's path, even if that split reduces uncertainty on average across the entire dataset.

Experimental Validation

The authors evaluated Local MDI against established benchmarks, including the synthetic led problem, the digits grayscale image dataset, and several UCI/Scikit-learn sets (Iris, Wine, Breast Cancer).

  • High Fidelity: In experiments on the digits and led datasets, Local MDI scores showed a mean correlation close to 1.0 with established (but slower) methods like TreeSHAP and Saabas' heuristic.
  • Consistency: As the number of trees in the forest increases, Local MDI converges to a stable and theoretically grounded explanation, demonstrating its reliability for high-stakes local explanations.

Limitations and Considerations

While the results are promising, the authors note several constraints:

  1. Categorical Setting: The tightest theoretical proofs rely on discrete variables and Shannon entropy. While extensions to regression (variance) and Gini index are discussed, the bounds are most rigorous in the categorical case.
  2. Masking Effects: In standard Random Forests where only a subset of features ($K < p$) is considered at each split, the bridge to Shapley values weakens. This is due to "masking," where a dominant feature may prevent other relevant features from being selected for splits.
  3. Asymptotic Assumptions: The proofs assume an infinite number of trees and a large learning sample; real-world performance on very small or noisy datasets may vary.

Conclusion

By proving that MDI is a Shapley value under totally randomized conditions, this paper provides a unified framework for understanding variable importance in Random Forests. Local MDI emerges as a powerful tool for XAI, offering the theoretical depth of game theory with the extreme computational efficiency of tree-based heuristics.

Summary updated

BibTeX
@inproceedings{sutera2021from,
  author = {Antonio Sutera and Gilles Louppe and Vân Anh Huynh-Thu and Louis Wehenkel and Pierre Geurts},
  title = {{From global to local MDI variable importances for random forests and when they are Shapley values}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=2vyiCxfb6el},
}
Figure