Created
June 14, 2022 10:40
-
-
Save algonacci/8673020bee3d9251c0fd9beabe46e3ba to your computer and use it in GitHub Desktop.
A script to make a callback on training
This file contains hidden or 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 myCallback(tf.keras.callbacks.Callback): | |
| def on_epoch_end(self, epoch, logs={}): | |
| if logs.get('accuracy') is not None and logs.get('val_accuracy') > 0.85: | |
| print("\nReached 85% validation accuracy so cancelling training!") | |
| self.model.stop_training = True | |
| callback = myCallback() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment