Debugging - AI

Output the actual values being predicted

# After the model is fit
print(model.predict(X_test[:10, :, :]))
        

Get a summary of the layers of a model

model.summary()
        

Performing a certain action after a certain step in training

# Haven't technically tested
# All methods - https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/Callback - Method here being "on_batch_end"
class HighAccuracyStoppage(tf.keras.callbacks.Callback):
    def on_batch_end(self, epoch, logs={}):
        if(logs.get('accuracy')>0.99):
        print("\nReached 99% accuracy so cancelling training!")
        self.model.stop_training = True