From the course: Applied Machine Learning: Supervised Learning

Unlock this course with a free trial

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

Overfitting

Overfitting

- [Instructor] Okay, let's look at overfitting now. We're going to do the same thing with the Decision Tree. We're just going to remove the max_depth hyperparameter. This lets it overfit. This is a key thing to realize, a Decision Tree in Scikit-Learn will probably overfit out of the box unless you take some steps to prevent that. Let's run this code, and here what we see is that the Training Score is very high. Remember, this is accuracy, it's between zero and one, while the Testing Score is not very good. So, basically, this has memorized the noise in the training data, and it can't generalize to data that it hasn't seen. To get around this, we would probably want to simplify the model.

Contents