Random Forest: Many Weak Learners Make One Strong Model
A random forest asks a crowd of simple decision trees for a prediction and takes the majority vote. This ensemble approach is used for classification and regression, correcting for a single tree's tendency to overfit. The footgun is its lower interpretability.
WHY IT EXISTS A single decision tree, while easy to understand, has a major flaw: it tends to overfit. It can learn the training data perfectly, including its noise and quirks, but then fail to generalize to new, unseen data. Random forests were created to get the predictive power of trees without this brittleness.
THE MENTAL MODEL Think of it as the "wisdom of the crowd." Instead of relying on one hyper-specialized expert (a single, deep decision tree) who might be biased, you consult a large committee of generalists. Each member of the committee (a tree) has seen a slightly different part of the problem. By averaging their opinions or taking a majority vote, the collective decision is more robust and less prone to individual errors.
HOW IT WORKS A random forest builds a multitude of individual decision trees at training time. For each tree, it takes a random sample of the data points and a random subset of the features. This ensures the trees are different from each other, or "decorrelated." To make a prediction, each tree in the forest gives its own output. For a classification task, the forest's final prediction is the class that received the most votes. For a regression task, it's the average of all the individual tree predictions.
WHEN TO USE IT Random forests are a strong default choice for tabular data problems, both for classification and regression. They are excellent when you need high predictive power without spending weeks tuning a more complex model. They handle missing values and maintain accuracy even with a large number of features, making them a go-to workhorse in machine learning.
WHEN NOT TO USE IT Avoid random forests when model interpretability is the top priority. It's hard to explain the exact logic behind a forest's prediction, unlike a single decision tree. They can also be computationally expensive and memory-intensive to train and store if you have a very large number of trees. They are also poor at extrapolating to values outside the range seen in the training data.
ONE CANONICAL EXAMPLE A bank wants to predict whether a loan applicant will default. A single decision tree might create a rule like "IF income < $30k AND has_prior_default = YES THEN default," which might be too specific. A random forest would build hundreds of trees, each using different subsets of applicants and features (income, credit score, age, etc.). The final prediction—default or not—is the majority vote from all these trees, making it more reliable than any single rule.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.