Normalization Techniques: BN and LN

Normalization Techniques

Motivation: Why needs Normalization?

Normalization has always been an active area of research in deep learning. There are some benefits of it:

  • It reduces Internal Covariate Shift. It is the change in the distribution of network activations due to the change in network parameters during training. It will move many of the distribution of network activations into the saturated regime of the nonlinearity and slow down the convergence. To improve training, we seek to reduce the internal covariate shift.
  • Normalization makes loss surface smoother.
  • It makes the Optimization faster because normalization doesn’t allow weights to explode all over the place and restricts them to a certain range.
Batch Normalization
Training Phase

Batch normalization is a method that normalizes activations in a network across the mini-batch of definite size. For each feature, batch normalization computes the mean and variance of that feature in the mini-batch . It then substracts the mean and divides the feature by its mini-batch standard deviation.

However, simply normalizing each input of a layer may change what the layer can represent. For instance, normalizing the inputs of a sigmoid would constrain them to the linear regime of the nonlinearity. To address this and make sure the transformation inserted in the network can represent the identity transform, a pair of parameters γ ( k ) , β ( k ) \gamma^{(k)},\beta^{(k)} γ(k),β(k) where introduced to scale and shift the normalized value for each activation x ( k ) x^{(k)} x(k):
y ( k ) = γ ( k ) x ^ ( k ) + β ( k ) y^{(k)} = \gamma^{(k)} \hat x^{(k)} + \beta^{(k)} y(k)=γ(k)x^(k)+β(k)
These parameters are learned along with the original model parameters, and restore the representation power of the network. Indeed, by setting γ ( k ) = V a r [ x ( k ) ] \gamma^{(k)}=\sqrt {Var[x^{(k)}]} γ(k)=Var[x(k)] and β ( k ) = E [ x ( k ) ] \beta^{(k)}=E[x^{(k)}] β(k)=E[x(k)], we could recover the original activatioins, if that were the optimal thing to do.

The batch normalization can be summarized as:

Inference Phase

During the inference phase, specifically when you only have one test sample, doing batch normalization as the one in training phase does not make sense, because your outputs at each layer of the network will be exactly zero. Instead. we use running mean and running variance calculated during training.

At each time step t t t during training, the runing mean μ B ′ [ t ] \mu_B'[t] μB[t] and running variance σ B ′ 2 \sigma_B'^2 σB2 are calculated as:
μ B ′ [ t ] = μ B ′ [ t ] × m o m e n t u m + μ B [ t ] × ( 1 − m o m e n t u m ) , \mu_B'[t]=\mu_B'[t]\times momentum+\mu_B[t]\times(1-momentum), μB</

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值