What is a Callback?
A callback is a helper that Keras runs automatically at certain moments of training, for example at the end of every epoch. It lets you control and monitor training without writing a manual loop.
Important Callbacks
| Callback | What it does |
|---|---|
EarlyStopping | Stops training when a metric stops improving |
ModelCheckpoint | Saves the model (or the best one) during training |
ReduceLROnPlateau | Lowers the learning rate when progress stalls |
TensorBoard | Writes logs to visualize training in a browser |
CSVLogger | Saves the metrics of each epoch to a CSV file |
LearningRateScheduler | Changes the learning rate with your own function |
Putting Them Together
- Set a big number of epochs, and let EarlyStopping decide when to stop
patience=5waits 5 epochs without improvementsave_best_only=Truekeeps only the best version on diskfactor=0.5halves the learning rate when stuck
Viewing TensorBoard
Open the address shown in the terminal (usually http://localhost:6006) to see live graphs of loss and accuracy. In a notebook you can use %load_ext tensorboard and %tensorboard --logdir logs.
Load the Best Model Later
Writing Your Own Callback
EarlyStopping together with ModelCheckpoint. You never have to guess how many epochs to train, and you always keep your best model.
Conclusion
Callbacks make training smarter and safer. Almost every real project uses at least EarlyStopping and ModelCheckpoint.

