EarlyStopping¶
-
class
behavenet.fitting.training.EarlyStopping(patience=10, min_epochs=10, delta=0)[source]¶ Bases:
objectStop training when a monitored quantity has stopped improving.
Adapted from: https://github.com/Bjarten/early-stopping-pytorch/blob/master/pytorchtools.py
Methods Summary
on_val_check(epoch, curr_loss)Check to see if loss has begun to increase on validation data for current epoch.
Methods Documentation
-
on_val_check(epoch, curr_loss)[source]¶ Check to see if loss has begun to increase on validation data for current epoch.
Rather than returning the results of the check, this method updates the class attribute
should_stop, which is checked externally by the fitting function.- Parameters
epoch (
int) – current epochcurr_loss (
float) – current loss
-