Dictionary of Applied Machine Learning: 107 machine-learning terms, each with a definition, a figure, citations and a Python demo · All terms · Demos · Start here
Updated on 2026-10-22
Readiness 100/100
See also ensemble bagging decision tree bootstrap feature importance variance
A random forest is the instance of bagging whose base learners learn decision trees. Each decision tree is trained on randomly selected data points of the training set, and each base learner also uses only a randomly selected subset of the features. The predictions of the base learners are aggregated by a majority vote in classification or by averaging in regression. The random selection of data points and of features aims at a decorrelation, so that aggregating reduces the variance of the returned prediction. The aggregation of base learners is a form of regularization and counteracts overfitting. A random forest also yields a feature importance score per feature: the fraction of the overall splits that use that feature.

randomforest.py, which recomputes what the entry states: the script block by block · open in ColabB-treesA bank must decide, for each loan
application, whether the applicant is creditworthy. A random
forest answers with the majority vote of many different
decision trees. A random forest is the instance of
bagging whose base learners learn
decision trees. As in bagging, each
decision tree is trained on randomly selected
data points of the training set. Besides the random
selection of data points, each base learner also uses
only a randomly selected subset of the features of the
original data points (Breiman, 2001).
The predictions of the base learners are
aggregated by a majority vote in classification or by
averaging in regression. The scatterplot of
Fig. 1 shows a
regression example: each data point is one of the
366 days of 2020 at the weather station Krems an der Donau, its
feature the minimum and its label the maximum air
temperature of the day. Three
decision trees, each trained on its own random selection
of the days, yield three different piecewise
constant hypotheses; the random forest delivers their
average.
pythondemos/randomforest.py
B-tradeThe random selection of data points and the random
selection of features both aim at a decorrelation of the
predictions that the base learners deliver for a
feature vector $\featurevec$ (Fig. 2;
Hastie et al., 2009, Sect. 15.2). While
withholding features lowers the correlation $\rho$
between the base learners, it raises the variance
$\sigma^{2}$ of each of them. The number of features
offered to each base learner is therefore worth tuning: too
many and the decision trees agree, too few and each of them
predicts poorly.
pythondemos/randomforest.py
See also: ensemble, bagging, decision tree, bootstrap, feature importance, variance, correlation.
@misc{dictml_randomforest,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {random forest},
howpublished = {Dictionary of Applied Machine Learning (course edition)},
year = {2026},
doi = {10.5281/zenodo.21569296},
note = {ISBN 978-952-64-3013-3, CC BY 4.0, retrieved 2026-10-27},
url = {https://dictionaryofml.org/terms/randomforest.html}
}