Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to create a custom callback function in keras while training the model

class myCallback(tf.keras.callbacks.Callback):
  def on_epoch_end(self, epoch, logs={}):
    if(logs.get('acc')>0.99):
      print("
Reached 99% accuracy so cancelling training!",epoch)
      self.model.stop_training = True
callback=myCallback()
model.fit(x_training, y_training,callbacks=[callback])
 
PREVIOUS NEXT
Tagged: #create #custom #callback #function #keras #training #model
ADD COMMENT
Topic
Name
7+9 =