Decision Tree
Decision Tree
nd
2 Edition
Chapter 6 – Decision Trees
Prepared by Glenn Miller for the San Diego Machine Learning MeetupTM group
Decision Tree (DT) + / -
ADVANTAGES DISADVANTAGES
• Simple to understand and interpret (‘White • Prone to overfitting (must restrict degrees of
Box’ model) freedom)
• Little data prep (e.g. no scaling) • Can be unstable (small data variations
produce big changes to the tree)
• Versatile (classification and regression)
• Cost of using the tree is logarithmic in # of • Predictions are piecewise constant
data points used to train the tree approximations (not smooth or continuous)
• Presorting the data (presort=True) can speed up training for small data sets
*If max_features is set, the algorithm will consider max_features features at each split, subject to a minimum one valid
partition of the node samples
Regularization and Pruning
Regularize: prevent the tree from growing too large (like the tree below) by limiting parameter(s)
before growing the tree (e.g., set max_depth or min_samples_leaf)
Prune: let the tree grow and then replace irrelevant nodes with leaves
Impurity
(Some) Iris
Species
• Versicolor
• Versicolor
Classification
Regression
Regularization / Pruning
Classification Regression