Decision Trees and Random Forests

A decision tree is just a flowchart. But a forest of them is one of the most powerful tools in ML.

Build 1.5 hr Python

Prerequisites: Phase 1 (Lessons 09 Information Theory, 06 Probability)

#Learning Objectives

  • Implement Gini impurity, entropy, and information gain calculations to find optimal decision tree splits
  • Build a decision tree classifier from scratch with pre-pruning controls (max depth, min samples)
  • Construct a random forest using bootstrap sampling and feature randomization, and explain why it reduces variance
  • Compare MDI feature importance with permutation importance and identify when MDI is biased
Full Access lesson

Keep going. The rest of this lesson is one step away.

Unlock all 503 lessons, video, code, quizzes and every future update. Pay in your own currency with Paystack.

The text and code of this lesson are based on AI Engineering from Scratch by Rohit Ghumare, MIT licensed.