Fix updating of best epoch during early stopping (#19164)
This commit is contained in:
parent
710b40dcb1
commit
5edf3419f9
1 changed files with 1 additions and 1 deletions
|
|
@ -746,7 +746,7 @@ class EarlyStopping:
|
||||||
if fitness is None: # check if fitness=None (happens when val=False)
|
if fitness is None: # check if fitness=None (happens when val=False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if fitness >= self.best_fitness: # >= 0 to allow for early zero-fitness stage of training
|
if fitness > self.best_fitness or self.best_fitness == 0: # allow for early zero-fitness stage of training
|
||||||
self.best_epoch = epoch
|
self.best_epoch = epoch
|
||||||
self.best_fitness = fitness
|
self.best_fitness = fitness
|
||||||
delta = epoch - self.best_epoch # epochs without improvement
|
delta = epoch - self.best_epoch # epochs without improvement
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue