Early stopping returns minimum value if the eval_metric is AUCPR


Hello Everyone,

I’m performing xgboost with eval_metric as ‘aucpr’ and early_stopping_rounds = 20.

When performing the early stopping it is only checking for the minimum value and returning if the value does not decrease, but the case should be it should pick up the maximum value instead. Can you please let me know the workaround.



You should add the parameter maximize = True during training.


I’m using python API XGBClassifier (https://xgboost.readthedocs.io/en/latest/python/python_api.html#module-xgboost.sklearn) which does not has maximize parameter.


In latest version, AUCPR is maximized in early stopping:

Can you double check if you are using a recent version of XGBoost?