human
I am working on the file "02-Classification/TensorFlow regularisation .ipynb".
The first task is:
Introduction to callbacks
But even now we're monitoring the performance of our model
on the validation set, we're still having to fix
the number of epochs that the model is training
for ahead of time. What we would like
to do is to have the ability to not only monitor the performance
of the network, but also perform certain actions depending on those
performance measures. 
That's where callbacks come in. Callbacks are an
important type of object TensorFlow and Keras that
are exactly designed to be able to monitor the loss in metrics at certain points in
the training run and perform some
action.
In TensorFlow, all callbacks are stored in the tensorflow.keras.callbacks
module. Inside that module, there's
a base class called callback which all other
callbacks inherit from. You can also subclass
the callback based class yourself to create
your own callbacks.
For example, one
of the methods of the callback base class
is called on_train_begin.
So we can override this method in our new callback to perform some action at the beginning
of the training run. Similarly, there
are more methods of the base class that are called at other points in the training, for example after each Epoch. 
Example training callback
Can you write Python program for it?
 Here we would like?
assistant
#Here we would like
.

# Write a custom callback

from tensorflow.keras.callbacks import Callback

class TrainingCallback(Callback):
    
    def on_train_begin(self, logs=None):
        print("Starting Training ...")

            # Print the loss and mean absolute error after each epoch
    def on_epoch_end(self, epoch, logs=None):
        print('Epoch {}: Average loss is {:7.2f}, mean absolute error is {:7.2f}.'.format(epoch, logs['loss'], logs['mae']))
    
    def on_train_end(self, logs=None):
        print("Finished training!")
        

# Train the model, with some of the data reserved for validation

regularisedModel.fit(train_data, train_targets, epochs = 3, batch_size=128, verbose=False, callbacks=[TrainingCallback()])