From fc0def1399e7f0a0a1ce750d045c604228588c76 Mon Sep 17 00:00:00 2001 From: fis Date: Thu, 17 Dec 2020 04:40:20 +0800 Subject: [PATCH] Revert changes. --- python-package/xgboost/callback.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python-package/xgboost/callback.py b/python-package/xgboost/callback.py index 6fa940ab9f0a..3c66ccfb8d58 100644 --- a/python-package/xgboost/callback.py +++ b/python-package/xgboost/callback.py @@ -212,7 +212,7 @@ def init(env): rabit.tracker_print(msg.format(metric_label, stopping_rounds)) state['maximize_score'] = maximize_score - + state['best_iteration'] = 0 if maximize_score: state['best_score'] = float('-inf') else: @@ -228,11 +228,9 @@ def init(env): state['best_iteration'] = int(bst.attr('best_iteration')) state['best_msg'] = bst.attr('best_msg') else: - state['best_iteration'] = 0 bst.set_attr(best_iteration=str(state['best_iteration'])) bst.set_attr(best_score=str(state['best_score'])) else: - state['best_iteration'] = 0 assert env.cvfolds is not None def callback(env):