difficulty 2/5
Decision tree
A model that predicts by asking a sequence of yes/no questions about the features, splitting the data at each answer until it reaches a leaf holding a prediction.
Intuition
A flowchart, learned from data. Is income above 50k? If yes, is age under 30? If no, is the account older than two years? Follow the answers down to a leaf, and the leaf holds the prediction.
What makes it a model rather than a hand-written rulebook is that the questions are chosen automatically: at each node the algorithm searches every feature and every threshold for the split that best separates the classes.
Formal definition
How it works
Where it's used
Why & when
Worked example
Pitfalls
Check yourself
3 questions
The questions on this page come with access. They are graded on the server, so the answers stay there until you have given yours.
On the cheat sheet: Tree ensembles →
Sources
- scikit-learn User Guide — Decision Treesdocs · retrieved 2026-08-31https://scikit-learn.org/stable/modules/tree.html
- Deep Learning (2016)book · retrieved 2026-10-07https://www.deeplearningbook.org/contents/ml.html
- scikit-learn — DecisionTreeClassifierdocs · retrieved 2026-10-07https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html