Decision Trees

16 min read

A decision tree makes a choice by asking a chain of yes or no questions, like the game of 20 questions. It is one of the easiest models to read and explain. In this lesson you learn how a tree picks its questions, and you grow one yourself.

New words

Decision tree
A model that asks yes or no questions one after another to decide.
Root, branch, leaf
The first question, a path after an answer, and a final answer box.
Split
A question that divides a group of rows into two smaller groups.
Gini impurity
A score of how mixed a group is. Zero means all the same.
Overfitting
Learning the training rows by heart, so new rows are predicted badly.
Random forest
Many different trees that vote, and the majority answer wins.

What you will learn

  1. How does a bank officer decide on a loan?
  2. What makes a question good?
  3. How do you measure "mixed" with Gini?
  4. How much does one question help?
  5. How does the tree choose the best question?
  6. A tree is just if and else
  7. Why do deep trees memorise?
  8. Try it: grow a loan tree
  9. Common mistakes
  10. Explain it to a friend
  11. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap