How Many Trees in a Random Forest? A Revisited Approach with Plateau Search and Optuna Integration

Vadim Porvatov, Andrey Dukhovny, Andrey Lange
6/2/2026
cs.LGmath.PR

Official code: lange-am/rf_plateau_hpo (0 stars, last commit 2026-05-27).

Abstract

Hyperparameter optimization (HPO) for Random Forest faces a specific difficulty in tuning the number of trees: the predictive score typically improves monotonically with ensemble size, so standard methods such as Tree-structured Parzen Estimator (TPE) and Hyperband require a predefined search range and often drive the estimate toward its right boundary. Early-stopping strategies avoid fixing such a range, but can be sensitive to score noise and prone to premature stopping. To address this, we propose an integrated triplet-based plateau-search algorithm that removes the number of trees from the direct TPE search space and still exploits information accumulated across HPO trials. The method adaptively tracks a near-minimal sufficient ensemble size by monitoring relative changes in the out-of-bag (OOB) score across a triplet of forest sizes and shifting this triplet accordingly. This yields an automated and user-interpretable procedure based on a tolerance parameter. We also provide a theoretical analysis: we relate the proposed relative OOB-score criterion to the gap between the current and limiting scores, and derive an asymptotic variance estimate for the corresponding OOB-based absolute relative difference. Experiments show that the selected number of trees can differ substantially from the common heuristic: for most classical benchmark datasets it is smaller, whereas for some high-dimensional bioinformatics datasets, such as Arcene and Dorothea, it is larger. The source code and reproducible experiments are available at https://github.com/lange-am/rf_plateau_hpo.

View on arXivView PDF

Code Implementations(1)

Triplet-based OOB plateau search that finds a near-minimal `n_estimators` while running Bayesian HPO (Optuna) over the other hyperparameters

00Shell, PythonOct 20, 20254 months agoNOASSERTION

Similar Papers

Cite this paper

@article{porvatov2026many,
  title  = {How Many Trees in a Random Forest? A Revisited Approach with Plateau Search and Optuna Integration},
  author = {Vadim Porvatov and Andrey Dukhovny and Andrey Lange},
  year   = {2026},
  eprint = {2606.03549},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.03549v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.03549.svg)](https://codeofpaper.com/paper/2606.03549)

Discussion