Commit 1c12a511 authored by Andrei Roibu's avatar Andrei Roibu
Browse files

removed save-checkpoing flag return

parent 852cdef8
......@@ -34,13 +34,12 @@ class EarlyStopping:
"""
def __init__(self, patience=5, min_delta=0, best_score=None, counter=0):
def __init__(self, patience=5, min_delta=0.0, best_score=None, counter=0):
self.patience = patience
self.counter = counter
self.best_score = best_score
self.early_stop = False
self.save_checkpoint = False
self.min_delta = min_delta
def __call__(self, validation_loss):
......@@ -49,11 +48,9 @@ class EarlyStopping:
if self.best_score is None:
self.best_score = score
self.save_checkpoint = True
elif np.greater(self.min_delta, self.best_score - score):
elif np.greater_equal(self.min_delta, self.best_score - score):
self.counter += 1
self.save_checkpoint = False
print("Early Stopping Counter: {}/{}".format(self.counter, self.patience))
if self.counter >= self.patience:
self.early_stop = True
......@@ -61,14 +58,5 @@ class EarlyStopping:
else:
self.best_score = score
self.counter = 0
self.save_checkpoint = True
return self.early_stop, self.save_checkpoint, self.best_score, self.counter
\ No newline at end of file
return self.early_stop, self.best_score, self.counter
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment