EarlyStopping#

class pinnx.callbacks.EarlyStopping(min_delta=0, patience=0, baseline=None, monitor='loss_train', start_from_epoch=0)[source]#

Stop training when a monitored quantity (training or testing loss) has stopped improving. Only checked at validation step according to display_every in Trainer.train.

Parameters:
  • min_delta – Minimum change in the monitored quantity to qualify as an improvement, i.e. an absolute change of less than min_delta, will count as no improvement.

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

  • baseline – Baseline value for the monitored quantity to reach. Training will stop if the trainer doesn’t show improvement over the baseline.

  • monitor – The loss function that is monitored. Either ‘loss_train’ or ‘loss_test’

  • start_from_epoch – Number of epochs to wait before starting to monitor improvement. This allows for a warm-up period in which no improvement is expected and thus training will not be stopped.

on_epoch_end()[source]#

Called at the end of every epoch.

on_train_begin()[source]#

Called at the beginning of trainer training.

on_train_end()[source]#

Called at the end of trainer training.