-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Labels
Description
When running xgboost.cv with early stopping rounds, after a few iterations the code breaks from a KeyError on the line below. There's some situation where state['bst_msg'] is not yet assigned, perhaps because it isn't set in init.
KeyError: 'best_msg'
xgboost/python-package/xgboost/callback.py
Line 246 in 8ca06ab
best_msg = state['best_msg'] |
I was running my code with nrounds=500 and early_stopping_rounds=20 (though I've run it in the range of 10 to 200 early_stopping_rounds).
bst_cv = xgb.cv(params, dtrain, 500, nfold = 5, shuffle=True, early_stopping_rounds=20)