Fix uninitialized value bug in xgboost callback (#5463)

Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
Melissa Kohl 2020-04-15 16:50:54 -07:00 committed by GitHub
parent 468b1594d3
commit 6a169cd41a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,6 +209,10 @@ def early_stop(stopping_rounds, maximize=False, verbose=True):
state['best_score'] = float('-inf') state['best_score'] = float('-inf')
else: else:
state['best_score'] = float('inf') state['best_score'] = float('inf')
msg = '[%d]\t%s' % (
env.iteration,
'\t'.join([_fmt_metric(x) for x in env.evaluation_result_list]))
state['best_msg'] = msg
if bst is not None: if bst is not None:
if bst.attr('best_score') is not None: if bst.attr('best_score') is not None: