Loading…
Glossary term
A model that makes predictions by following a series of yes-or-no questions about the input.
A decision tree makes a prediction by asking a series of simple questions about the input, each splitting the data, until it reaches a leaf with the answer. Training chooses the questions that best separate the data. Trees are easy to read, but a single deep tree can overfit.
Train a decision tree
from sklearn.tree import DecisionTreeClassifier
tree = DecisionTreeClassifier(max_depth=3).fit(X_train, y_train)They are interpretable and the building block of powerful ensembles like random forests.