matchzoo.utils.early_stopping

Early stopping.

Module Contents

Classes

EarlyStopping

EarlyStopping stops training if no improvement after a given patience.

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.

state_dict(self) → typing.Dict[str, typing.Any]

A Trainer can use this to serialize the state.

load_state_dict(self, state_dict: typing.Dict[str, typing.Any]) → None

Hydrate a early stopping from a serialized state.

update(self, result: list)

Call function.

property best_so_far(self) → bool

Returns best so far.

property is_best_so_far(self) → bool

Returns true if it is the best so far.

property should_stop_early(self) → bool

Returns true if improvement has stopped for long enough.