Created
December 21, 2019 19:36
-
-
Save akiatoji/eea9c73535a6834b980d9d0bca758eb5 to your computer and use it in GitHub Desktop.
Simple callback in Keras
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
# Sometimes EarlyStopping is too much hassle | |
class myCallback(tf.keras.callbacks.Callback): | |
def on_epoch_end(self, epoch, logs={}): | |
if (logs.get('acc') >= 0.998): | |
print("\nReached 99.8% accuracy so cancelling training!") | |
self.model.stop_training = True | |
cb = myCallback() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment