Module lessons (1/5)
Decision trees
Gini impurity, growing and limiting a tree, and reading its rules.
What you'll learn in this lesson
- Explain how a decision tree classifies by asking a series of yes-or-no questions.
- Compute Gini impurity and see how a split reduces it.
- Control the size of a tree and read its rules.
Overview
A decision tree plays twenty questions with your data. At each step it asks one question about one feature, such as "is petal length at most 2.45 cm?", and sends the sample left or right. It stops at a leaf, which predicts the majority class of the training samples that ended up there.
Unlike the models so far, a tree needs no scaling, copes with different feature types, and its rules can be read by a person.
Sections covered in this lesson
- 1The hook: twenty questions
- 2How it picks a question
- 3Try it: grow a tree
- 4Controlling tree growth and purity
- 5Keeping a tree under control
- 6Progressive examples: Gini purity to readable rules
Unlock "Decision trees" and the full Machine Learning: from first principles to practice curriculum
Gini impurity, growing and limiting a tree, and reading its rules.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Machine Learning: from first principles to practice plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.