Empty evaluation list in early stopping should produce meaningful error message (#4633)
* Empty evaluation list should not break early stopping * Fix lint * Update callback.py
This commit is contained in:
parent
4df246191f
commit
b7a1f22d24
@ -222,9 +222,9 @@ def early_stop(stopping_rounds, maximize=False, verbose=True):
|
|||||||
|
|
||||||
def callback(env):
|
def callback(env):
|
||||||
"""internal function"""
|
"""internal function"""
|
||||||
score = env.evaluation_result_list[-1][1]
|
|
||||||
if not state:
|
if not state:
|
||||||
init(env)
|
init(env)
|
||||||
|
score = env.evaluation_result_list[-1][1]
|
||||||
best_score = state['best_score']
|
best_score = state['best_score']
|
||||||
best_iteration = state['best_iteration']
|
best_iteration = state['best_iteration']
|
||||||
maximize_score = state['maximize_score']
|
maximize_score = state['maximize_score']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user