topskill.dev
CoursesTracks
All courses/Machine Learning FundamentalsRandom forests
Supervised prediction algorithms
6 / 10
← Machine Learning Fundamentals
○What machine learning learns○Features and labels○Training and inference○Regression or classification○The machine learning process○Data quality and coverage○Representing data✦Module Quiz
○Linear regression○Try a tiny linear model○Logistic regression○Nearest neighbors○Decision trees●Random forests○Boosting○Naive Bayes○Support vector machines✦Module Quiz
○Clustering○K-means○Choosing and interpreting clusters○Principal component analysis○Neural networks and deep learning○Self-supervised learning○Transfer learning○Reinforcement learning✦Module Quiz
○Generalization and overfitting○Holding out evaluation data○Data leakage○Baselines○Bias and variance intuition○Reading learning curves✦Module Quiz
○Prediction errors and residuals○Measuring regression error○Squared error and large misses○The confusion matrix○Precision and recall○Try a held-out classifier✦Module Quiz
○Bias and limits○Monitoring and drift○Comparing models for a decision✦Module Quiz
Supervised prediction algorithms

Random forests

A random forest combines many decision trees. Each tree trains on a randomly sampled set of training rows, usually sampled with replacement. That means a row may appear more than once. Each split also considers a random selection of features.

These choices encourage the trees to differ. If all trees made exactly the same mistakes, combining them would add little. A forest averages numerical predictions for regression. For classification, implementations may combine votes or average class probabilities before choosing a class.

Our toy regression forest predicts 21 minutes by averaging 18, 24, and 21. One tree's unusually high estimate has less influence on the combined result than it would alone.

Forests often make predictions less sensitive to peculiarities of one training sample than a single deep tree. They do not remove bad labels or unrepresentative data. They also cost more memory and computation, and explaining hundreds of trees is harder than tracing one short path. A forest is a useful candidate, not an automatic upgrade for every problem.

Averaging is most helpful when errors are not perfectly aligned. Randomness encourages diversity but cannot create information absent from every tree. If all training records exclude an important condition, adding more trees does not supply examples of that condition.

Check your understanding

Would averaging many identical trees correct their shared mistake?

Answer: No. The same error would appear in every prediction; useful diversity is part of the reason forests help.

Fact 1
1 / 1
FACT 1

No. The same error would appear in every prediction; useful diversity is part of the reason forests help.