Skip to content

Instantly share code, notes, and snippets.

@kamal2230

kamal2230/mc4.py Secret

Created October 11, 2020 06:54
Show Gist options
  • Save kamal2230/169feda676fef77cd91a310937d01dfd to your computer and use it in GitHub Desktop.
Save kamal2230/169feda676fef77cd91a310937d01dfd to your computer and use it in GitHub Desktop.
model.compile(loss = 'categorical_crossentropy',
optimizer = 'adam',
metrics = ['accuracy'])
class myCallback(tf.keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs={}):
if(logs.get('accuracy')>0.95):
print("\nReached >95% accuracy so cancelling training!")
self.model.stop_training = True
callbacks = myCallback()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment