To find the hyperparameter where the estimator is neither underfitting nor overfitting, use Yellowbrick’s validation curve.
As we can see from the plot above, although max_depth
> 2 has a higher training score but a lower cross-validation score. This indicates that the model is overfitting.
Thus, the sweet spot will be where the cross-validation score neither increases nor decreases, which is 2.