class myCallback(tf.keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs={}):
'''
Halts the training after reaching 90 percent accuracy
Args:
epoch (integer) - index of epoch (required but unused in the function definition below)
logs (dict) - metric results from the training epoch
'''
# Check accuracy
if(logs.get('accuracy') > 0.9):
# Stop if threshold is met
print("\nAccuracy is grater than 0.6 so cancelling training!")
self.model.stop_training = True
# Instantiate class
callbacks = myCallback()