EarlyStoppingHandle
- class hybrid_learning.concepts.train_eval.base_handles.early_stopping.EarlyStoppingHandle(min_delta=0.001, patience=1, verbose=False)[source]
 Bases:
objectHandle encapsulating early stopping checks. It measures the progress given the previous steps and determines whether one should proceed or stop early. This value is then stored in require_stop.
Usage: Initialize the handle, then apply after each epoch
step()to the loss tensor.step()will update the current best values and returns the new value ofrequire_stop.Public Data Attributes:
A dict with the settings.
Public Methods:
reset()Reset the history of the handle to start at step 0.
step(loss)Update stopping flag according to latest epoch results.
Special Methods:
__init__([min_delta, patience, verbose])Init.
__repr__()String representation with all properties.
__str__()Return str(self).
- __init__(min_delta=0.001, patience=1, verbose=False)[source]
 Init.
- Parameters
 min_delta (float) – minimum decrease of the loss value such that it is considered progress. If the loss should be increasing, assign corresponding negative
min_deltapatience (int) – number of steps (epochs) with no progress after which to suggest to stop; values <=0 are mapped to 1 (i.e. no patience, stop if no progress since last step)
verbose (bool) – logging verbosity level.
- step(loss)[source]
 Update stopping flag according to latest epoch results. If stopping is required, set
require_stoptoTrue.- Parameters
 loss (float) – the loss of the last epoch unseen to the handle
- Returns
 the new value of
require_stop- Return type
 
- min_delta
 Minimum decrease (increase if <0) of loss value per step to be considered a progress.
- patience
 Number of steps with no progress after which to suggest to stop.
- require_stop
 Whether the early stopping handle would suggest to stop or to proceed. Updated using the
step()method.
- verbose
 Verbosity level (simple logging switch).