intermediateadvanced-ml

Random Forest

A forest of imperfect decision trees that together make surprisingly few mistakes.

Key Points

What it is

Random Forest builds many decision trees, each trained on a random sample of the data and a random subset of features, then averages their predictions (regression) or takes a majority vote (classification). This randomness makes each tree different, so their combined errors cancel out.

Why it exists

A single decision tree grown deep enough will overfit — it memorizes the training data. Random Forest was built to keep the trees' flexibility while cancelling out their individual overfitting through averaging many decorrelated trees.

Intuition

One decision tree is like one overconfident intern making a call based on limited experience. A random forest is 500 interns, each shown a different random slice of the company's history and a different random subset of the available reports, each making their own call independently. Vote them together and the group answer is far more reliable than any one intern's guess.

How it works

  1. Bootstrap sampling

    For each tree, randomly sample the training data with replacement to create a slightly different dataset.

  2. Random feature subset

    At every split in every tree, only consider a random subset of features rather than all of them.

  3. Grow trees independently

    Grow each tree fully (or to a max depth) without pruning — individual trees are allowed to overfit.

  4. Aggregate predictions

    Combine all trees' outputs by majority vote (classification) or averaging (regression).

When to use

When not to use

Common mistakes

In practice

One of the most common baseline models for structured/tabular data — used for churn prediction, credit scoring, fraud detection, and as a quick feature-importance check before building anything fancier.

Was this concept helpful?

Spot an error or gap? Suggest an edit →

Related concepts

ensemble-methodsdecision-treesgradient-boostingbias-variance-tradeoff
Chirp at me!