Applying early stopping
Early stopping is a general method to limit the number of training rounds in iterative machine learning algorithms. In this section, we look at eval_set
, eval_metric
, and early_stopping_rounds
to apply early stopping.
What is early stopping?
Early stopping provides a limit to the number of rounds that iterative machine learning algorithms train on. Instead of predefining the number of training rounds, early stopping allows training to continue until n consecutive rounds fail to produce any gains, where n is a number decided by the user.
It doesn't make sense to only choose multiples of 100 when looking for n_estimators
. It's possible that the best value is 737 instead of 700. Finding a value this precise manually can be tiring, especially when hyperparameter adjustments may require changes down the road.
With XGBoost, a score may be determined after each boosting round. Although scores go up and down, eventually scores will level off or...