Overview

9 From single trees to random forests: Leo Breiman and the logic of ensemble learning

Random forests grew out of Leo Breiman’s effort to solve the problem of overfitting and poor generalization in decision trees without giving up their flexibility. A single tree is easy to understand and can capture nonlinear relationships and interactions, but it is also highly unstable: small changes in the training data can change early splits and produce a very different model. As trees grow deeper, they become more likely to fit noise rather than durable patterns, so pruning can help but cannot remove the basic fragility of relying on one tree.

Breiman’s key insight was to turn that instability into an advantage by building many trees and combining them. Bagging does this by training each tree on a bootstrap sample, so some observations are repeated and others are left out, and then aggregating the trees’ predictions by voting or averaging. Random forests add a second layer of randomness by limiting each split to a random subset of features, which prevents a few dominant predictors from shaping every tree in the same way. The result is a collection of trees that are individually imperfect but collectively more stable, because diversity among their errors makes aggregation effective.

The chapter also explains why random forests work well in practice and how they can be evaluated and interpreted. Breiman framed performance in terms of tree strength and correlation: each tree must remain useful, but the trees must also be different enough that their errors do not move together too closely. Out-of-bag observations provide an internal way to estimate error without separate validation data, while permutation and impurity-based importance scores recover a form of interpretation by showing which features matter most to the forest. In this way, random forests preserve much of the predictive power of deep trees while replacing the transparency of a single structure with measurable ensemble behavior.

Bagging with decision trees. Bootstrap sampling creates multiple training sets by drawing observations with replacement, so each sample contains duplicated and omitted observations. A separate decision tree is trained on each sample using the same procedure. The trees’ predictions are then combined by majority vote for classification or averaging for regression, producing a more stable final prediction.
Feature subsampling in a random forest. The simplified example represents two trees trained to evaluate the same type of loan application. To isolate feature-level randomness, both trees are shown using the same training data. At the illustrated split, the first tree is permitted to consider only Age and Income, while the second can consider only Balance and Tenure. After evaluating the candidates available to it, the first tree selects Age ≤ 45 and the second selects Balance > X, where X represents the threshold that best satisfies the splitting criterion. These different initial decisions send applicants into different branches and influence every split that follows. In a complete random forest, each tree also receives a different bootstrap sample, and a new random subset of features is selected at every node. The trees and candidate sets shown here are deliberately simplified to isolate how feature selection creates structural diversity.
Permutation importance using out-of-bag observations. The forest first establishes baseline predictions and error using observations that were omitted from the bootstrap samples of the trees evaluating them. The values of feature X are then randomly shuffled among those observations, disrupting the relationships carried by that feature while leaving the other feature columns unchanged. Without retraining the forest, the same trees recalculate their predictions from the modified data. The increase from baseline error to permuted error measures how much predictive performance depended on feature X. In Breiman’s original procedure, the error increase is calculated within each tree’s out-of-bag observations and then averaged across the forest.

Summary

  • A decision tree learns through greedy recursive splitting. At each node, it selects the feature and splitting rule that produce the greatest immediate improvement, continuing until predictions are assigned at its leaves. Trees support classification and regression, capture nonlinear relationships and interactions, accommodate different variable types, and provide a decision structure that can be inspected directly.
  • The flexibility of a single tree also makes it unstable. Small changes in the training data can alter an early split and propagate throughout the remaining structure. Increasing depth allows the tree to capture more signal but also more noise, producing high variance and overfitting. Pruning can reduce these effects, but the resulting tree still depends on one training sample.
  • Breiman’s 1996 bagging method addressed instability through bootstrap sampling and aggregation. Each tree is trained on a sample created by drawing observations with replacement from the original data. Classification predictions are combined by voting, while regression predictions are averaged. Bagging reduces variance without requiring the individual trees to surrender their expressive power.
  • Breiman’s 2001 random forests retained bagging and added randomness to the features considered at each split. Each constituent tree otherwise follows the ordinary decision-tree process, but it receives its own bootstrap sample and a new random subset of candidate features at every node. Predictions from the resulting trees are then aggregated into one forest prediction.
  • Feature randomness prevents dominant predictors from shaping every tree in the same way. Temporarily withholding those predictors forces some trees to use other informative features, producing different early splits and structures. Considering fewer features can weaken an individual tree, but the resulting reduction in correlation can strengthen the forest by making aggregation more effective.
  • Generalization depends on balancing the predictive strength of the trees against the correlation among their behavior. For classification forests, margins measure the voting advantage of the known class over its strongest incorrect competitor, and average margin defines forest strength. Strong trees with highly correlated errors provide limited gains, while diverse but weak trees provide too little reliable information.
  • Adding trees to a forest differs from increasing the depth of one tree. Additional independently randomized trees stabilize class-vote proportions or averaged regression predictions, causing the forest to approach a limiting result. More trees cannot correct data leakage, poor features, unsuitable settings, or weak and highly correlated learners; they cause the forest to converge more precisely toward the result implied by its design.
  • Out-of-bag observations provide an internal means of evaluating predictive performance. Each observation is predicted using only trees whose bootstrap samples omitted it. Comparing these predictions with known outcomes produces classification or regression error estimates without requiring a separate validation procedure, although an independent test set remains valuable after model selection and tuning.
  • Variable importance recovers a measure of the interpretation lost when one visible tree becomes a forest. Permutation importance measures how much out-of-bag error increases when a feature is disrupted, while impurity-based importance accumulates its contributions to improved splits. Both require caution because correlated predictors, splitting opportunities, and proxy relationships can distort scores, and predictive importance does not establish causality.
  • Support vector machines and random forests offered two enduring answers to the generalization problem. Vapnik controlled variability within one model through geometry, margin, and constraint. Breiman reduced variability across many models through sampling, feature randomness, and aggregation. Random forests demonstrate that reliable learning can emerge not only by restricting complexity, but also by organizing it into a stable and understandable system.

FAQ

What problem were random forests designed to solve?Random forests were designed to improve generalization, especially for flexible models like decision trees that fit training data well but can perform unreliably on new observations. Breiman’s idea was to keep the tree’s expressive power while reducing its instability through randomness and aggregation.
Why are single decision trees considered unstable?Single decision trees are trained greedily, so small changes in the data can change early splits, especially near the root. Those early changes cascade through the rest of the tree, producing very different structures and predictions from one sample to another.
How does overfitting happen in a decision tree?As a tree grows deeper, it creates smaller and more specific partitions of the data. This lets it capture real patterns, but it can also fit noise and sample-specific quirks, leading to strong training performance and weaker performance on new data.
Why isn’t pruning enough to fix decision tree instability?Pruning can reduce overfitting by making a tree smaller and less variable, but it does not remove the underlying dependence on the particular training sample. A pruned tree is still just one structure, so small changes in the data can still produce a different tree.
What is bagging in the context of random forests?Bagging, or bootstrap aggregation, trains many models on bootstrap samples of the original data and combines their predictions. In random forests, bagging creates diverse trees by changing the observations each tree sees, and aggregation stabilizes the final prediction.
What is bootstrap sampling, and how does it create different training sets?Bootstrap sampling draws observations with replacement from the original training set. Because some observations are repeated and others are left out, each tree is trained on a slightly different version of the data.
How does aggregation improve prediction accuracy?Aggregation combines the predictions of many trees by majority vote for classification or averaging for regression. Individual tree errors can cancel each other out, so the ensemble is less sensitive to the quirks of any one tree.
Why did Breiman add random feature selection to bagging?Bootstrap sampling alone does not always create enough diversity, especially when a few predictors are very strong. Random feature selection forces each split to consider only a subset of features, which prevents the same dominant predictors from shaping every tree in the same way.
What do strength and correlation mean in Breiman’s theory of random forests?Strength refers to how predictive the individual trees are on average, while correlation refers to how similarly the trees make errors. Random forests work best when the trees are strong enough to be useful but not so correlated that they repeat the same mistakes.
How do out-of-bag evaluation and variable importance help interpret random forests?Out-of-bag evaluation estimates predictive performance using observations not seen by a given tree during training. Variable importance shows which features most affect the forest’s predictions, helping recover some interpretability even though the model is made of many trees rather than one visible structure.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Timeless Algorithms, The Foundational Ideas ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Timeless Algorithms, The Foundational Ideas ebook for free