liveBook · Manning

Batch normalization

As explained in Deep Learning with R, Third Edition

Batch normalization is a neural-network normalization technique that standardizes layer activations using mini-batch statistics during training and stored moving statistics during inference.

Batch normalization standardizes intermediate neural-network activations, not only the original input. It helps keep changing layer outputs centered and scaled while a model trains. section 9.3

During training, the layer uses the current mini-batch’s mean and variance. During inference, it uses exponential moving averages collected from training, when a representative batch may not be available. Keras stores these statistics as nontrainable weights, updated during the forward pass rather than by backpropagation. section 7.4.1 section 9.3

Use batch normalization as an architectural pattern:

  • Place it after a convolution or dense transformation and before the activation. section 9.3
  • Treat its benefit as an empirical engineering practice: the commonly cited internal-covariate-shift explanation is not certain. section 9.3
  • Combine it with residual connections when building very deep convolutional networks to maintain stable gradient flow. section 20.6

Keras convolution block

x <- x |> layer_conv_2d(32, 3, use_bias = FALSE) |> layer_batch_normalization() |> layer_activation("relu")

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains batch statistics, moving inference statistics, weight categories, layer ordering, and practical limitations of its rationale.
Examples
Uses Keras Conv2D blocks that place BatchNormalization before ReLU and remove the preceding convolution bias.
What it assumes
Assumes basic data normalization and neural-network layers, while explaining training-versus-inference behavior from the layer level.
What you can do after
Apply it via Keras by inserting BatchNormalization between a transformation layer and its activation.
How it connects
Connects batch normalization with data normalization, convolution layers, activation functions, residual connections, and gradient flow.

Also explained in

Compare how 9 books explain batch normalization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.