Normalization (machine learning)
In machine learning, normalization is a statistical technique with various applications. There are mainly two forms of normalization, data normalization and activation normalization. Data normalization is a general technique in statistics, and it includes methods that rescale input data so that they have well-behaved range, mean, variance, and other statistical properties. Activation normalization is specific to deep learning, and it includes methods that rescale the activation of hidden neurons inside a neural network.
Normalization is often used for faster training convergence, less sensitivity to variations in input data, less overfitting, and better generalization to unseen data. They are often theoretically justified as reducing covariance shift, smoother optimization landscapes, increasing regularization, though they are mainly justified by empirical success.[1]
Data normalization
Normalization is often used in applications involving distances and similarities between data points, such as clustering and similarity search. As an example, the K-means clustering algorithm is sensitive to feature scales.
Notation
- is a dataset.
- is an individual data in the dataset.
- is the minimum value in the dataset.
- is the maximum value in the dataset.
- is the mean value of the dataset.
- is the standard deviation of the dataset.
Min-max scaling
Min-max scaling, also known as min-max normalization, is a linear transformation that rescales data into a specific range, typically between 0 and 1. Given a dataset with a feature , the min-max scaled value is calculated as:For example, with [1, 5, 10], , Applying min-max scaling, we get [0, 0.44, 1].
Standardization

Standardization, often referred to as z-score normalization, transforms data to have a mean () of 0 and a standard deviation () of 1. This process centers the data around zero and scales it based on the spread of the original data:In other words, it normalizes each data point to be its z-score relative to the normal distribution .
Mean normalization
Mean normalization changes data to have mean of 0 and range contained within :
Robust Scaling
Robust scaling, also known as standardization using median and interquartile range (IQR), is designed to be robust to outliers. It scales features using the median and IQR as reference points instead of the mean and standard deviation:where are the three quartiles (25th, 50th, 75th percentile) of the feature.
Unit vector normalization
Unit vector normalization regards each individual data point as a vector, and divide each by its vector norm, to obtain . Any vector norm can be used, but the most common ones are the L1 norm and the L2 norm.
For example, if , then its Lp-normalized version is:
Activation normalization
In a deep neural network, the neural activations are arrays of numbers. The output array of each layer is the input data to the next layer. While this means data normalization techniques can be applied to normalize neural activations, specialized techniques were developed which were empirically found to work better.
Normalization can also equalize the effect of features to the learning process, preventing data imbalance and make it so that one learning rate works for all the weights.
Typically, the benefits of activation normalization are reported as: stabilizing the gradients during training, less sensitive to weight initialization, faster convergence, larger learning rates, allowing deeper networks to be trained, model regularization, reducing overfitting, better generalization.
Batch normalization
Batch normalization (BatchNorm)[2] operates on the activations of a layer for each mini-batch rather than on the input features across the entire dataset.
It is typically applied after the linear transformation (and before the activation function) within a neural network layer.
Instead of applying a fixed formula like Min-Max or Standardization, BatchNorm learns the optimal scaling and shifting parameters for each layer during training. For a given mini-batch and feature map, it calculates the mean () and variance () and uses them to normalize the activations. To maintain the expressive power of the network, learnable parameters (scale) and (shift) are introduced:
- represents individual activations in the mini-batch.
- is a small constant added for numerical stability.
It is claimed in the original publication that BatchNorm works by reducing "internal covariance shift", though the claim has both supporters[3][4] and detractors.[5][6]
Layer normalization
Layer normalization (LayerNorm)[7] is a common competitor to BatchNorm. Unlike BatchNorm, which normalizes activations across the batch dimension for a given feature, LayerNorm normalizes across all the features within a single data sample. Compared to BatchNorm, LayerNorm's performance is not affected by batch size, making it more stable when using smaller batch sizes or working with recurrent neural networks (RNNs).
It is a key component of Transformers, particularly for natural language processing tasks.
For a given data sample and layer, LayerNorm computes the mean () and variance () over all the features. Similar to BatchNorm, learnable parameters (scale) and (shift) are applied:
- represents the features (activations) for a single data sample.
- is a small constant added for numerical stability.
See also
- ^ Huang, Lei (2022). Normalization Techniques in Deep Learning. Synthesis Lectures on Computer Vision. Cham: Springer International Publishing. doi:10.1007/978-3-031-14595-7. ISBN 978-3-031-14594-0.
- ^ Ioffe, Sergey; Szegedy, Christian (2015-06-01). "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift". Proceedings of the 32nd International Conference on Machine Learning. PMLR: 448–456.
- ^ Xu, Jingjing; Sun, Xu; Zhang, Zhiyuan; Zhao, Guangxiang; Lin, Junyang (2019). "Understanding and Improving Layer Normalization". Advances in Neural Information Processing Systems. 32. Curran Associates, Inc.
- ^ Awais, Muhammad; Bin Iqbal, Md. Tauhid; Bae, Sung-Ho (2021-11). "Revisiting Internal Covariate Shift for Batch Normalization". IEEE Transactions on Neural Networks and Learning Systems. 32 (11): 5082–5092. doi:10.1109/TNNLS.2020.3026784. ISSN 2162-237X.
{{cite journal}}
: Check date values in:|date=
(help) - ^ Bjorck, Nils; Gomes, Carla P; Selman, Bart; Weinberger, Kilian Q (2018). "Understanding Batch Normalization". Advances in Neural Information Processing Systems. 31. Curran Associates, Inc.
- ^ Santurkar, Shibani; Tsipras, Dimitris; Ilyas, Andrew; Madry, Aleksander (2018). "How Does Batch Normalization Help Optimization?". Advances in Neural Information Processing Systems. 31. Curran Associates, Inc.
- ^ Ba, Jimmy Lei; Kiros, Jamie Ryan; Hinton, Geoffrey E. (2016). "Layer Normalization". doi:10.48550/ARXIV.1607.06450.
{{cite journal}}
: Cite journal requires|journal=
(help)