liveBook · Manning

Random forest

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

An ensemble of randomized decision trees whose predictions are aggregated.

A random forest combines many randomized decision trees into one prediction. Each tree sees a different sample of training cases and a changing set of candidate features at every split, producing diverse predictions that are aggregated for greater reliability. section 5.1.2 section 5.6

The main design choices create a practical bias–variance trade-off:

  • Bootstrapping gives trees slightly different training samples, while feature sampling creates different tree structures and less-correlated predictions. section 5.1.2
  • Binary classification uses majority voting: the most frequent tree prediction becomes the forest’s class prediction. section 5.1.2
  • Useful tuning controls include the number of trees, maximum features per split, maximum tree depth, and minimum terminal-branch size. section 5.6
  • More trees can improve reliability but increase computation; forests can also estimate feature importance and case similarity. section 5.6

A tabular classification workflow

A scikit-learn pipeline can one-hot encode categorical columns, pass through continuous columns, and fit a RandomForestClassifier with 300 trees, a minimum leaf size of 3, shuffled five-fold cross-validation, and a fixed random state. The same family of randomized trees can serve as a RandomForestRegressor inside IterativeImputer for multivariate missing-value estimation; deeper or larger forests improve estimates at additional computational cost. section 5.1.2 section 6.1.1

Figure 5.4 How random forests arrives at its results by combining the different data partitioning due to its decision trees thanks to majority voting

Visualizes how different tree partitions combine through majority voting into a final classification. section 5.1.2

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Explains bootstrapping, per-split feature sampling, voting, tuning, variance reduction, and computational trade-offs.
Examples
Uses binary classification, majority voting, a scikit-learn preprocessing pipeline, and RandomForestRegressor-based missing-value estimation.
What it assumes
Assumes decision trees, binary splits, bootstrapping, feature sampling, and basic ensemble strategies.
What you can do after
Apply it via scikit-learn for classification, regression-based imputation, feature-importance analysis, and case-similarity measurement.
How it connects
Connects decision trees, bagging, averaging, boosting, feature importance, extremely randomized trees, and iterative imputation.

Also explained in

Compare how 11 books explain random forest →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.