matchzoo.utils.early_stopping
¶
Early stopping.
Module Contents¶
-
class
matchzoo.utils.early_stopping.
EarlyStopping
(patience:typing.Optional[int]=None, should_decrease:bool=None, key:typing.Any=None)¶ EarlyStopping stops training if no improvement after a given patience.
Parameters: - patience – Number fo events to wait if no improvement and then stop the training.
- should_decrease – The way to judge the best so far.
- key – Key of metric to be compared.
-
best_so_far
¶ Returns best so far.
-
is_best_so_far
¶ Returns true if it is the best so far.
-
should_stop_early
¶ Returns true if improvement has stopped for long enough.
-
state_dict
(self)¶ A Trainer can use this to serialize the state.
-
load_state_dict
(self, state_dict:typing.Dict[str, typing.Any])¶ Hydrate a early stopping from a serialized state.
-
update
(self, result:list)¶ Call function.