Stability of Random Forests and Coverage of Random-Forest Prediction Intervals

Yan Wang, Huaiqing Wu, Dan Nettleton · DOI

Abstract

Random Forests (RF) are a cornerstone of modern machine learning, yet their theoretical properties—particularly regarding uncertainty quantification—have remained elusive. This paper establishes the first theoretical proof that standard Random Forests are algorithmically stable. By leveraging this stability, the authors demonstrate that prediction intervals (PIs) derived from "out-of-bag" (OOB) errors are theoretically sound and provide reliable coverage. This finding justifies a computationally efficient "free lunch" for practitioners: the ability to quantify model uncertainty without the overhead of expensive cross-validation or jackknife procedures.

Introduction

Despite their empirical dominance in tabular data tasks, Random Forests are often treated as "black boxes." While point predictions are easily obtained, providing a reliable measure of uncertainty—specifically a prediction interval that likely contains the true outcome—is more challenging.

Existing methods for constructing distribution-free prediction intervals, such as the "jackknife+," require training multiple versions of a model on different subsets of data. For large-scale Random Forests, this is computationally prohibitive. Consequently, practitioners often rely on out-of-bag (OOB) errors, which are generated naturally during the bootstrap sampling process of RF training. However, until now, the validity of OOB-based intervals lacked a rigorous theoretical foundation. This paper bridges that gap by connecting the concept of algorithmic stability to the coverage guarantees of OOB prediction intervals.

Theoretical Framework: Algorithmic Stability

The core of the authors' argument rests on algorithmic stability. An algorithm is considered stable if its output does not change significantly when a single training point is removed from the dataset.

Establishing Stability in RF

The authors prove that Random Forests are stable under the mild condition that the squared response variable ($Y^2$) does not exhibit a "heavy tail" (i.e., extreme outliers are not excessively frequent). Their proof follows a two-step progression:

  1. Derandomized Forests: They first establish stability for "infinite" forests where the number of trees ($B$) is effectively infinite.
  2. Finite-B Forests: They extend this proof to the finite-tree forests used in practical applications, showing that stability holds as the dataset size ($n$) and tree count ($B$) increase.

The "Free Lunch" of Prediction Intervals

Using the established stability property, the authors derive non-asymptotic lower and upper bounds for the coverage probability of OOB-based prediction intervals.

If an algorithm is stable, its "leave-one-out" errors (which OOB errors approximate) behave similarly to errors encountered on entirely new test points. This allows the OOB errors to serve as a valid proxy for true prediction errors. The paper demonstrates that as the number of data points grows, the coverage of these intervals converges to the target level (e.g., 95%) under much weaker assumptions than those required by previous literature.

Experimental Validation

The theoretical findings were validated through both synthetic simulations and real-world benchmarks:

  • Synthetic Simulation (Heavy-Tail Testing): The authors used a dataset ($n=4000$) where the response $Y$ followed a standard Cauchy distribution. Because the Cauchy distribution is notoriously heavy-tailed, it served as a stress test for the stability theory. Interestingly, the RF remained stable even when theoretical assumptions were pushed to their limits.
  • UCI Benchmarks: The authors tested the method on four real-world datasets: Concrete (compressive strength), Airfoil (self-noise), Bioconcentration (chemical properties), and Naval (gas turbine decay). In all cases, the distribution of OOB errors closely matched the distribution of true prediction errors, confirming the calibration of the intervals.

Key Results

  • Theorem 1 (Stability): Formally proves that the difference between a full RF predictor and an OOB predictor vanishes as $n$ and $B$ increase.
  • Theorems 2 & 3 (Coverage Bounds): These theorems establish that the probability of the true value falling within the OOB-based interval is at least $1 - \alpha - O(\sqrt{\nu_{n,B}})$, where $\alpha$ is the significance level and $\nu$ is a small stability parameter.
  • Empirical Calibration: Density plots across all tested real-world datasets showed a striking alignment between OOB error distributions and true test error distributions.

Conclusion and Future Work

This research provides a rigorous justification for using OOB errors to construct prediction intervals, confirming that the "free lunch" utilized by practitioners is theoretically sound. It highlights stability as the fundamental property enabling distribution-free predictive inference.

However, some avenues for future research remain. The current proof relies on a "sub-gamma" assumption for $Y^2$, though empirical evidence suggests RF is stable even with heavier tails. Additionally, the current upper bounds for coverage assume a continuous response variable; extending this framework to discrete or categorical data would further broaden the utility of these findings. Finally, while the bounds are mathematically sound, they are somewhat conservative; future work may yield tighter bounds by analyzing the specific mechanics of greedy tree-splitting rules more deeply.

Summary updated

BibTeX
@inproceedings{wang2023stability,
  author = {Yan Wang and Huaiqing Wu and Dan Nettleton},
  title = {{Stability of Random Forests and Coverage of Random-Forest Prediction Intervals}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=xPqINp0Eu1},
}
Figure