netket.callbacks.EarlyStopping

class netket.callbacks.EarlyStopping(min_delta=0.0, patience=0, baseline=None, monitor='mean')[source]

Bases: object

A simple callback to stop NetKet if there are no more improvements in the training. based on driver._loss_name.

__init__(min_delta=0.0, patience=0, baseline=None, monitor='mean')

Initialize self. See help(type(self)) for accurate signature.

Parameters
  • min_delta (float) –

  • patience (Union[int, float]) –

  • baseline (Optional[float]) –

  • monitor (str) –

Return type

None

Attributes
baseline: float = None

Baseline value for the monitored quantity. Training will stop if the driver hits the baseline.

min_delta: float = 0.0

Minimum change in the monitored quantity to qualify as an improvement.

monitor: str = 'mean'

Loss statistic to monitor. Should be one of ‘mean’, ‘variance’, ‘sigma’.

patience: Union[int, float] = 0

Number of epochs with no improvement after which training will be stopped.

Methods
__call__(step, log_data, driver)[source]

A boolean function that determines whether or not to stop training.

Parameters
  • step – An integer corresponding to the step (iteration or epoch) in training.

  • log_data – A dictionary containing log data for training.

  • driver – A NetKet variational driver.

Returns

A boolean. If True, training continues, else, it does not.