When training an XGBoost model with early stopping on Databricks, what does early_stopping_rounds=10 mean?
Select an answer to reveal the explanation.
Short Explanation and Infographic
early_stopping_rounds is a patience parameter — XGBoost will keep training until the validation score goes 10 rounds without improving, then stops and rolls back to the best checkpoint.
Full explanation below image
Full Explanation
In XGBoost: xgb.train(params, dtrain, num_boost_round=1000, evals=[(dval, 'eval')], early_stopping_rounds=10). With early_stopping_rounds=10: XGBoost evaluates the validation metric after each boosting round. If the best validation metric has not improved for 10 consecutive rounds, training stops. The model is kept at the best round (lowest validation loss), not the last round. This prevents overfitting (training loss keeps decreasing while validation loss plateaus or increases). The best_iteration attribute on the trained booster tells you where training was stopped. Typical workflow: set num_boost_round=1000 (large max), early_stopping_rounds=10-50, and let early stopping find the optimal number of trees. In scikit-learn API: XGBClassifier(n_estimators=1000, early_stopping_rounds=10) with eval_set parameter in fit().