How to Plot Model Loss During Training in TensorFlow

How you can step up your model training by plotting live the learning of your model.

Daniel
Geek Culture

--

Image By Author (Logos by Keras and Tensorflow)

The Keras progress bars look nice if you are training 20 epochs, but no one wants an infinite scroll in their logs of 300 epochs progress bars (I find it disgusting). It makes it difficult to get a sense of the progress of training, and it’s just bad practice (at least if you’re training from a Jupyter Notebook).

The alternative is to have a simple plot, with train and test loss, that updates every epoch or every n steps. It’s an extremely simple implementation and it’s much more useful and insightful.

So let’s get into it.

How Does a Keras Callback Work

A Keras Callback is a class that has different functions that are executed at different times during training [1]:

  • When fit/evaluate/predict starts & ends
  • When each epoch starts & ends
  • When each training batch starts & ends
  • When each evaluation (test) batch starts & ends
  • When each inference (prediction) batch starts & ends

--

--