Batch Normalization 批标准化及其相关数学原理和推导

数据经过一层层网络之后,输出的数据分布会发生变化,此现象称为Internal Covariate Shift,会给下一层的网络学习带来困难:

  1. 整个网络的学习速度较慢;
  2. 数据的分布容易陷入激活函数(如sigmoid,tanh)的梯度饱和区,减慢了网络的收敛速度。

直接对每一层做归一化是不合理的

如果将每一层的输出都归一化为标准正态分布,均值为0,方差为1,会导致网络完全学习不到输入数据的特征,因为所有的特征都被归一化了。

底层网络学习到的参数信息被丢掉了,降低了网络的数据表达能力。

Batch Normalization的步骤 1

  1. 求出整个batch数据的均值:
    μ b = 1 m ∑ i = 1 m x i \mu_b=\frac{1}{m}\sum_{i=1}^mx_i μb=m1i=1mxi

  2. 求出整个batch数据的方差:
    σ b 2 = 1 m ∑ i = 1 m ( x i − μ b ) 2 \sigma^2_b = \frac{1}{m}\sum_{i=1}^m(x_i-\mu_b)^2 σb2=m1i=1m(xiμb)2

  3. 将数据归一化为标准正态分布:
    x ^ i = x i − μ b σ b 2 + ε \hat{x}_i = \frac{x_i-\mu_b}{\sqrt{\sigma^2_b+\varepsilon}} x^i=σb2+ε xiμb
    其中的 ε \varepsilon ε是为了防止方差为0。

  4. 引入平移缩放参数,得到最终的归一化结果:
    y i = γ x ^ i + β y_i = \gamma\hat{x}_i+\beta yi=γx^i+β

测试阶段使用Unbiased variance estimate 2 来进行总体方差的无偏估计

Question: Is the estimate of the population variance that arises in this way using the sample mean always smaller than what we would get if we used the population mean?
Answer: yes except when the sample mean happens to be the same as the population mean.

We are seeking the sum of squares of distances from the population mean, but end up calculating the sum of squares of differences from the sample mean, which, as will be seen, is the number that minimizes that sum of squares of distances. So unless the sample happens to have the same mean as the population, this estimate will always underestimate the sum of squared differences from the population mean.

证明过程如下:

设样本的平均值是 μ s \mu_s μs,设总体的平均值是 μ \mu μ,则
(1) μ s = 1 m ∑ i = 1 m x i \mu_s = \frac{1}{m}\sum_{i=1}^mx_i \tag{1} μs=m1i=

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值