[backport] Fix save_best. (#6523)

This commit is contained in:
Jiaming Yuan
2020-12-18 20:00:29 +08:00
committed by GitHub
parent 8be2cd8c91
commit bce7ca313c
2 changed files with 4 additions and 2 deletions

View File

@@ -148,7 +148,7 @@ class TestCallbacks:
eval_metric=tm.eval_error_metric, callbacks=[early_stop])
booster = cls.get_booster()
dump = booster.get_dump(dump_format='json')
assert len(dump) == booster.best_iteration
assert len(dump) == booster.best_iteration + 1
early_stop = xgb.callback.EarlyStopping(rounds=early_stopping_rounds,
save_best=True)