keras.callbacks.history

my_callbacks = [
    tf.keras.callbacks.EarlyStopping(patience=2),
    tf.keras.callbacks.ModelCheckpoint(filepath='model.{epoch:02d}-{val_loss:.2f}.h5'),
    tf.keras.callbacks.TensorBoard(log_dir='./logs'),
]
model.fit(dataset, epochs=10, callbacks=my_callbacks)

Here is what the above code is Doing:
1. The first callback we’re passing is EarlyStopping. This callback will stop training when it sees that the validation loss isn’t decreasing for two epochs.
2. The second callback we’re passing is ModelCheckpoint. This callback saves the model after every epoch.
3. The third callback we’re passing is TensorBoard. This callback saves logs that can be loaded into TensorBoard to help visualize the training process.

To use TensorBoard with Keras, you’ll need to install TensorBoard with pip.

pip install tensorboard

Then, after training the model, you can launch TensorBoard from the command line.

tensorboard –logdir=logs/

You can then navigate to http://localhost:6006/ to see the TensorBoard dashboard.