From the course: Machine Learning with Python: Decision Trees

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

How to prune a decision tree

How to prune a decision tree

- [Instructor] The basic idea behind recursive partitioning is to repeatedly split data into smaller subsets in such a way that maximizes the homogeneity or similarity of items within each subset. Generally, this process continues until all of the instances within a partition are of the same class or value or all the features in the dataset have been exhausted or when some user-defined condition has been satisfied. Usually, if we allow a tree to grow uninhibited until it meets the first two criteria, it may be too large or it may overfit against the training data. Overfitting occurs when a decision tree fits our data too perfectly. A tree that overfits does a great job explaining the data in the training set but performs poorly when given new or test data. To avoid overfitting, we have to carefully manage the size of a decision tree during or after the recursive partitioning process. this process is known as pruning.…

Contents