I was reading the batch normalization (BN) paper (1) and didn't understand the need to use moving averages to track the accuracy of the model and even if I accepted that it was the right thing to do, I don't understand what they are doing exactly.

To my understanding (which my be wrong), the paper mentions that it uses the population statistics rather than the mini-batch, statistics once the model has finished training. After some discussion of unbiased estimates (that seems tangential to me and don't understand why it talks about that) they go and say:

Using moving averages instead, we track the accuracy of the model as it trains.

That is the part that is confusing to me. Why do they do moving averages to estimate the accuracy of the model and over what data set?

Usually what people do to estimate the generalization of their model, they just track the validation error of their model (and potentially early stop their gradient descent to regularize). However, it seems that batch normalization is doing something completely different. Can someone clarify what and why its doing something different?

1: Ioffe S. and Szegedy C. (2015),
"Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift",
Proceedings of the 32nd International Conference on Machine Learning, Lille, France, 2015.
Journal of Machine Learning Research: W&CP volume 37

  • 1
    $\begingroup$ Are you satisfied with the upvoted answer? It isn't an "answer" at all, if you ask me; if still relevant, I can provide a better answer. $\endgroup$ – OverLordGoldDragon Nov 8 '19 at 20:26
  • 1
    $\begingroup$ @OverLordGoldDragon provide ur own answer :) $\endgroup$ – Pinocchio Dec 27 '19 at 5:05

When using batch_normalization first thing we have to understand is it work on two different ways when in Training and Testing .

  1. In Training we need to calculate mini batch mean in order to normalize the batch

  2. In the inference we just apply pre-calculated mini batch statistics

So in the 2nd thing how to calculate this mini batch statics

Here comes the moving average

running_mean = momentum * running_mean + (1 - momentum) * sample_mean
running_var = momentum * running_var + (1 - momentum) * sample_var
| cite | improve this answer | |
  • 1
    $\begingroup$ This does not answer the question whatsoever; "why" and "how" was asked, and a superficial "what" was given. It shouldn't be upvoted. $\endgroup$ – OverLordGoldDragon Nov 8 '19 at 20:26
  • $\begingroup$ does the pre-calcualted stats come from data at training or test? $\endgroup$ – Charlie Parker Mar 6 at 8:53
  • $\begingroup$ @CharlieParker Training data, I would presume. The mini-batches are created during training and their mean/variance is also calculated during training, after all. $\endgroup$ – Mateen Ulhaq Apr 9 at 0:06

They are talking about batch normalization, which they have described for the training procedure but not for inference.

This is a process of normalizing the hidden units using sample means etc.

In this section they explain what to do for the inference stage, when you are just making predictions ( ie after training has completed).

However, in stopped validation you interleave prediction on validation set with training to estimate your validation error.

So during this process you don't have a population average (the averages are still changing as you train), so then you use a running average to calculate the batch norm parameters to calculate performance on validation set.

It is in this sense that

Using moving averages instead, we track the accuracy of the model as it trains.

nothing to do with literally using the running means as a metric for neural network performance.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.