What is the best way to smoothen out a loss curve plot

I am currently using a loss averaged over the last 100 iterations, but this leads to artifacts like the loss going down even when the current iteration has an average loss, because the loss 100 iterations ago was a large outlier.

I thought about using different interval lengths, but I wonder if an average over the last few iterations really is the right way to plot the loss.

Are there common alternatives? Maybe using decaying weights in the average? What are the best-practices for visualizing the loss?

• Why do you need to average the loss? Loss is suppose to decrease over time, so getting the average of loss over time is meaningless – Clement Hui Jan 4 at 12:01
• The variance of the loss per iteration is a lot larger than the decrease of the loss between the iterations. For example I currently have a loss between 2.6 and 3.2 in the last 100 iterations with an average of 2.92. As the scatter plot is almost useless to see the trend, I visualize the average as well. – allo Jan 4 at 12:40
• Oh. Perhaps yous re looking for this: en.wikipedia.org/wiki/Moving_average#Exponential_moving_average – Clement Hui Jan 4 at 12:49