Warning Message When optimizing 'early_stopping_rounds' of XGBClassifier with GridSearchCV

Hi,

I have used GridSearchCV of sklearn to optimize the early_stopping_rounds and some other parameters of XGBClassifier for a 2-class dataset as follows:

xgb_param = { ‘early_stopping_rounds’: [5,10],
‘n_estimators’: [30,50,80,100,150,200,300],
‘max_depth’: [3,4],
‘random_state’: [0,1,123456789]}

xgb=XGBClassifier(eval_metric=‘logloss’, n_jobs=-1)
search = GridSearchCV(xgb, xgb_param, scoring=‘roc_auc’, n_jobs=-1, cv=5)

However, the following warning message is displayed on screen during running the above code:

Parameters: { “early_stopping_rounds” } might not be used.

This could be a false alarm, with some parameters getting used by language bindings but
then being mistakenly passed down to XGBoost core, or some parameter actually being used
but getting flagged wrongly here. Please open an issue if you find any such cases.

Is above code correct?

Thanks
David

With current version of XGBoost, you cannot optimize early_stopping_rounds using GridSearchCV. This limitation will be removed in the upcoming release of XGBoost (1.6.0).