Skip to content
Advertisement

Elegant way to plot average loss of many trains in tensorflow

I am running many iterations of a train so I can smooth out the loss curves. I would like an elegant way to average all the losses from history.history['loss'] but haven’t found an easy way to do it. Here’s a minimal example:

JavaScript

If I wanted to plot just one example, I would do this:

JavaScript

But instead, I want to average the loss from each train in all_trains and plot them. I can think of many clunky ways to do it but would like to find a clean way.

Advertisement

Answer

You could simply do:

JavaScript

enter image description here

I also added the standard deviation in this case.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement