EarlyStoppingTrigger(self, check_trigger=(1, 'epoch'), monitor='main/loss', patience=3, mode='auto', verbose=False, max_trigger=(100, 'epoch'))¶
Trigger for Early Stopping
It can be used as a stop trigger of
Trainerto realize early stopping technique.
This trigger works as follows. Within each check interval defined by the
check_triggerargument, it monitors and accumulates the reported value at each iteration. At the end of each interval, it computes the mean of the accumulated values and compares it to the previous ones to maintain the best value. When it finds that the best value is not updated for some periods (defined by
patience), this trigger fires.
monitor (str) – The metric you want to monitor
check_trigger – Trigger that decides the comparison interval between current best value and new value. This must be a tuple in the form of
<int>, 'iteration'which is passed to
patience (int) – Counts to let the trigger be patient. The trigger will not fire until the condition is met for successive
mode (str) –
'auto'. It is used to determine how to compare the monitored values.
verbose (bool) – Enable verbose output. If verbose is true, you can get more information
max_trigger – Upper bound of the number of training loops
patientsis also available as an alias of
patiencefor historical reason.
Decides whether the training loop should be stopped.