Last active
June 6, 2019 00:07
-
-
Save Attila94/1fd1efee13b0c02fdbef4928c773f3b0 to your computer and use it in GitHub Desktop.
Keras Early Stopping callback with minimum target to reach before starting to monitor target value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyEarlyStopping(EarlyStopping): | |
def __init__(self, minimum_target=None, **kwargs): | |
self.minimum_target = minimum_target | |
super(MyEarlyStopping, self).__init__(**kwargs) | |
def on_epoch_end(self, epoch, logs): | |
current = logs.get(self.monitor) | |
if self.minimum_target and self.monitor_op(self.minimum_target, current): | |
super(MyEarlyStopping, self).on_epoch_end(epoch, logs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment