View on GitHub

How a decision tree thinks

Machine learning lesson ready

This model plays 20 questions with your data, and you can read every answer.

The idea

A decision tree predicts by asking yes-or-no questions: is the income above 50k? Is the account older than a year? Each question splits the data, and the tree picks the question that makes the groups as pure as possible.

Trees are the base of random forests and gradient boosting, which still win most competitions on tabular data. Unlike a neural network, you can print a tree and follow its reasoning.

What the lesson will build

Key ideas

The video

The lesson is ready: code and a line-by-line walkthrough in machine-learning/08-decision-trees/.


All topics · Suggest a topic