Random forest calibration

Mohammad Hossein Shaker, Eyke Hüllermeier

In the landscape of machine learning, we often demand more from our models than simple labels; we require a measure of certainty. While Random Forests (RF) are renowned for their predictive robustness, their ability to provide "calibrated" probabilities—where a 70% prediction corresponds to a 70% actual frequency—has been a subject of ongoing debate. A recent study by Shaker and Hüllermeier (2025) provides a comprehensive evaluation of how to ensure Random Forests accurately reflect their own uncertainty.

The Calibration Challenge

In safety-critical domains such as medical diagnostics or financial risk assessment, a model’s confidence is as vital as its accuracy. An uncalibrated classifier might be overconfident (predicting 99% certainty for an event that only occurs 80% of the time) or underconfident. While the community has often assumed Random Forests are naturally well-calibrated due to their ensemble nature, rigorous large-scale evidence has been lacking. This research investigates whether practitioners should focus on post-processing probabilities after training or simply optimize the training process itself.

Methodology and Data

The researchers compared several approaches across 30 real-world datasets from the UCI and PROMISE repositories, as well as synthetic data. Synthetic datasets, such as multi-variate Gaussian distributions, were crucial because they allowed the authors to calculate the True Calibration Error (TCE), a metric that is impossible to determine in real-world scenarios where true underlying probabilities are unknown.

Visualization of a synthetic binary classification dataset used to evaluate calibration performance across different feature distributions.

The study evaluated:

  • Intrinsic Tuning: Adjusting parameters like max_depth and ensemble size, and applying Laplace smoothing.
  • Post-processing: Standard methods like Platt Scaling and Isotonic Regression, alongside advanced techniques like Venn-Abers (VA) calibration.
  • RF-Specific Methods: Novel approaches like the RF Rank Calibrator.

The "Goldilocks" Depth

A pivotal finding of the study is the impact of tree depth on calibration. The researchers identified a "Goldilocks" zone for tree depth that balances two types of loss: refinement and grouping. Shallow trees are often under-refined, producing vague probabilities, while excessively deep trees overfit, pushing leaf nodes toward pure classes and resulting in extreme (0 or 1) probability estimates.

Reliability diagrams demonstrating how tree depth affects calibration. Depth 4 shows the best alignment between true and predicted probabilities, minimizing the True Calibration Error (TCE).

As shown in the reliability diagrams, an intermediate depth allows the forest to produce near-perfectly calibrated probabilities without the need for external post-processing. Furthermore, increasing the number of trees in the ensemble consistently reduces noise and improves calibration quality.

Key Insights

  1. Optimized RFs are Competitive: A well-tuned Random Forest (RF_opt) often matches or exceeds the performance of complex post-hoc calibration methods. In many cases, methods like Isotonic Regression actually slightly decreased raw classification accuracy while trying to fix probabilities.
  2. Out-of-Bag (OOB) Efficiency: Using OOB data—the samples left out during the bagging process—provides an unbiased source for calibration. This allows for effective calibration without sacrificing training data, a significant advantage in data-scarce environments.
  3. Venn-Abers for Precision: If minimizing the Expected Calibration Error (ECE) is the primary goal, Venn-Abers calibration remains the most consistent performer, albeit at a higher computational cost.

Conclusion

The study concludes that post-processing is not a mandatory step for Random Forests. By focusing on intrinsic hyper-parameter tuning—specifically tree depth and ensemble size—and leveraging OOB data, practitioners can achieve state-of-the-art calibration. This simplifies the machine learning pipeline while maintaining high levels of both accuracy and reliability.

Reference: Shaker, M. H., & Hüllermeier, E. (2025). Random forest calibration. Knowledge-Based Systems, 328, 114143. https://doi.org/10.1016/j.knosys.2025.114143

Summary updated

BibTeX
@article{shaker2025random,
  author = {Mohammad Hossein Shaker and Eyke Hüllermeier},
  title = {{Random forest calibration}},
  journal = {Knowledge-Based Systems},
  year = {2025},
  doi = {10.1016/j.knosys.2025.114143},
}
Figure