Back to Supervised Learning

Decision Trees and Random Forests

The model that dominates tabular ML. Trees, then forests, then why bagging works. FIND_VIDEO: search 'decision tree random forest tutorial' — recommended channel: StatQuest. Aim for 11 min or under.

10 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Decision Tree LimitationsDecision trees are easy to use but are inaccurate for predictive learning on new samples.
  2. Random Forest AdvantageRandom Forests combine the simplicity of trees with flexibility, resulting in vastly improved accuracy.
  3. Step 1: Bootstrapping DataA bootstrapped dataset is created by randomly selecting samples from the original data with replacement.
  4. Step 2: Building TreesBuild a decision tree using the bootstrapped data, but only consider a random subset of variables at each split.
  5. Forest VarietyRepeating the process creates a wide variety of trees, which makes the Random Forest effective.
  6. Using the Forest (Voting)To classify a new sample, run it through all trees and use the majority vote for the final prediction.
  7. Terminology: BaggingThe process of bootstrapping data and aggregating results via voting is called bagging.
  8. Out-of-Bag DatasetThe Out-of-Bag (OOB) dataset consists of samples not used to build a specific tree, typically about one-third of the data.
  9. Estimating OOB ErrorOOB samples are used to measure accuracy, and the proportion incorrectly classified is the OOB error.
  10. Optimizing VariablesOptimize the forest by comparing OOB error rates across different numbers of variables considered per step.
PDF notes

Frequently asked questions

Why are Decision Trees "not that awesome" in practice?

They work great on the data used to create them, but they lack flexibility and are inaccurate when classifying new, unseen samples.

What is the key difference between bootstrapping and standard sampling?

Bootstrapping involves sampling with replacement, meaning the same sample can be selected multiple times to create the new dataset.

What is "bagging"?

Bagging is the combination of bootstrapping the data and then aggregating the results (like voting) from the resulting models to make a final decision.

How many variables should I consider at each split?

A common starting point is the square root of the total number of variables; then test settings above and below this value.

What proportion of data usually ends up in the Out-of-Bag dataset?

Typically, about one-third (1/3) of the original data is not included in any specific bootstrapped dataset.