Skip to content

Instantly share code, notes, and snippets.

@kamal2230

kamal2230/mc4.py Secret

Created October 11, 2020 06:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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