Fast Estimation of Partial Dependence Functions using Trees

Jinyang Liu, Tessa Steensgaard, Marvin N. Wright, Niklas Pfister, Munir Hiabu · DOI

Abstract

Popular model interpretation tools like SHAP often face a trade-off between computational speed and mathematical accuracy. This paper introduces FastPD, a novel tree-based algorithm that provides consistent, unbiased estimation of Partial Dependence (PD) functions with linear time complexity. By decoupling tree traversal from evaluation, FastPD enables the decomposition of complex models into main effects and interactions without the speed bottlenecks or correlation biases found in existing methods.

Introduction

As machine learning models, such as XGBoost and LightGBM, increase in complexity, post-hoc explanation methods like Partial Dependence (PD) plots and Shapley Additive Explanations (SHAP) have become essential. However, practitioners currently face two major hurdles:

  1. The Speed-Accuracy Trade-off: The widely used "path-dependent" TreeSHAP is fast but inconsistent. When features are correlated, it can produce biased or misleading explanations.
  2. Computational Scalability: The "interventional" version of SHAP is mathematically consistent but computationally expensive, scaling quadratically ($O(n^2)$) with the number of observations, making it impractical for large datasets.

FastPD bridges this gap by providing an estimator that is both fast (linear complexity) and consistent, even in the presence of correlated features.

Methods: The FastPD Algorithm

FastPD exploits the inherent structure of decision trees to estimate PD functions efficiently. The core innovation lies in a two-phase process:

  • Augmentation (Precomputation): The algorithm traverses the tree and, for every leaf, identifies which background observations would have arrived there if specific feature splits were ignored. These are stored as counts or lists at each node.
  • Evaluation: To explain a specific data point, the algorithm retrieves this precomputed information. Because the heavy lifting is done during augmentation, calculating the PD function for any feature subset becomes a simple retrieval and summation task.
The FastPD augmentation process involves traversing the tree to precompute background sample distributions across nodes.

By decoupling these steps, FastPD moves from the quadratic complexity of traditional interventional methods to linear complexity ($O(n_e + n_b)$) relative to the number of evaluation ($n_e$) and background ($n_b$) samples.

Performance and Complexity

The researchers compared FastPD against several state-of-the-art methods. As shown in the table below, FastPD is the only method that maintains both consistency ($v_S(x)$) and linear scaling with respect to the number of samples.

Comparison of complexity and consistency across various model interpretation methods.

In runtime tests, FastPD scaled linearly, while Vanilla PD and Interventional TreeSHAP scaled quadratically. For a dataset of 8,000 samples, FastPD completed calculations in seconds, whereas traditional methods required hours. Furthermore, simulation studies confirmed that as the number of background samples increases, FastPD's Mean Squared Error (MSE) drops toward zero, while TreeSHAP-path's error plateaus due to inherent bias.

Key Insights

  • Functional ANOVA Decomposition: FastPD facilitates a full functional decomposition, allowing users to separate a feature's "Main Effect" from its "Interaction Effects" with other variables.
  • Consistency over Tree Structure: The paper proves that TreeSHAP-path can yield different values for two different trees representing the exact same function. FastPD avoids this inconsistency by focusing on the underlying PD functions.
  • Real-World Application: On the Adult Income dataset, FastPD successfully captured nuanced interactions between age, gender, and income that standard path-dependent algorithms failed to detect.

Limitations and Future Work

While FastPD offers significant speedups, it introduces a memory overhead during the augmentation step, as it must store indices at the leaves. This can be mitigated by limiting tree depth. Additionally, like all PD-based methods, FastPD may extrapolate into "empty" regions of the feature space. Future research may adapt the FastPD framework to estimate Accumulated Local Effects (ALE), which are more robust to such extrapolation issues.

Summary updated

BibTeX
@inproceedings{liu2025fast,
  author = {Jinyang Liu and Tessa Steensgaard and Marvin N. Wright and Niklas Pfister and Munir Hiabu},
  title = {{Fast Estimation of Partial Dependence Functions using Trees}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=JTOOU5SsXT},
}
Figure