Batch Norm、Layer Norm、Weight Norm与SELU
加速网络收敛——BN、LN、WN与selu
自Batch Norm出现之后,Layer Norm和Weight Norm作为Batch Norm的变体相继出现。最近又出来一个很”简单”的激活函数Selu,能够实现automatic rescale and shift。这些结构都是为了保证网络能够堆叠的更深的基本条件之一。除了这四种,还有highway network与resnet。
Batch Norm
BN对某一层激活值做batch维度的归一化,也就是对于每个batch,该层相应的output位置归一化所使用的mean和variance都是一样的。
- BN的学习参数包含rescale和shift两个参数;训练的时候不断更新这两个参数和moving average mean and variance
 - BN在单独的层级之间使用比较方便,比如CNN
 - 像RNN这样unroll之后层数不定,直接用BN不太方便,需要对每一层(每个time step)做BN,并保留每一层的mean和variance。不过由于RNN输入不定长(time step长度不定),可能会有validation或test的time step比train set里面的任何数据都长,因此会造成mean和variance不存在的情况。针对这个情况,需要对每个time step独立做统计。在BN-LSTM中是这么做的:Generalizing the model to sequences longer than those seen during training is straightforward thanks to the rapid convergence of the activations to their steady-state distributions (cf. Figure 5). For our experiments we estimate the population statistics separately for each timestep 1, . . . , Tmax where Tmax is the length of the longest training sequence. When at test time we need to generalize beyond Tmax, we use the population statistic of time Tmax for all time steps beyond it. During training we estimate the statistics across the minibatch, independently for each timestep. At test time we use estimates obtained by averaging the minibatch estimates over the training set.当然,也可以只对输入-隐层进行BN,或者stack RNN中同一个time step的不同层之间做BN
 - BN会引入噪声(因为是mini batch而不是整个training set),所以对于噪声敏感的方法(如RL)不太适用
 
BN算法思路如下(注意training和inference时候的区别)。
Layer Norm
LN也是对输出归一化的。LN也是为了消除各层的covariate shift,加快收敛速度。LN相对于BN就简单多了。
- 它在training和inference时没有区别,只需要对当前隐藏层计算mean and variance就行
 - 不需要保存每层的moving average mean and variance
 - 不受batch size的限制,可以通过online learning的方式一条一条的输入训练数据
 - LN可以方便的在RNN中使用
 - LN增加了gain和bias作为学习的参数,μ和σ分别是该layer的隐层维度的均值和方差
 


Weight Norm
WN是使用参数重写(reparameterization weight normalization)的方法来做归一化的。哪里有weight,哪里就可以用WN来归一化。WN也是用来加速收敛的。通过对weight进行normalization,可以保证在梯度回传的时候,如果梯度越noisy(梯度越大),v的norm就越大,那么g/||v||就越小,从而就会抑制梯度。做到了梯度的自稳定(self-stabilize)。
与LN稍不一样,WN只有gain这一个学习参数
前向传播时,BN就是简单的normalization

- 梯度回传的时候,会对梯度做自稳定
 

- 论文里提到了WN能够让learning rate自适应/自稳定
 
If the learning rate is too large, the norm of the unnormalized weights grows quickly until an appropriate effective learning rate is reached. Once the norm of the weights has grown large with respect to the norm of the updates, the effective learning rate stabilizes.
- WN与BN一样,只不过BN直接从输出角度出发,WN从weight角度出发
 


- 注意WN的初始化,需要用第一个minibatch的均值和方差来初始化g和b。
 

- Mean-only BN
 
考虑到BN并不能保证参数v的协方差矩阵为单位矩阵,也就是BN不能保证激活值与v独立。而WN能做到,因此可以结合WN与BN,此时的BN经过修改,只进行去均值操作。
selu
最理想的结果就是让每一层输出的激活值为零均值、单位方差,从而能够使得张量在传播的过程当中,不会出现covariant shift,保证回传梯度的稳定性,不会有梯度爆炸或弥散的问题。selu能够很好的实现automatically shift and rescale neuron activations towards zero mean and unit variance without explicit normalization like what batch normalization technique does.
并且可以参考References中的Selus与Leaky Relu以及Relu之间的对比。selu 推荐用在大训练样本的数据集上。
References
Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks
Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift
RECURRENT BATCH NORMALIZATION
Layer Normalization
深度学习加速策略BN、WN和LN的联系与区别,各自的优缺点和适用的场景?
SELUs (scaled exponential linear units) - Visualized and Histogramed Comparisons among ReLU and Leaky ReLU
引爆机器学习圈:「自归一化神经网络」提出新型激活函数SELU
来源: http://skyhigh233.com/blog/2017/07/21/norm/
Batch Norm、Layer Norm、Weight Norm与SELU的更多相关文章
- 【算法】Normalization
		
Normalization(归一化) 写这一篇的原因是以前只知道一个Batch Normalization,自以为懂了.结果最近看文章,又发现一个Layer Normalization,一下就懵逼了. ...
 - A Brief Overview of Deep Learning
		
A Brief Overview of Deep Learning (This is a guest post by Ilya Sutskever on the intuition behind de ...
 - Batch Norm 与 Layer Norm 比较
		
一.结论 Batch Norm一般用于CV领域,而Layer Norm一般用于NLP领域 Batch Norm需要计算全局平均,而Layer Norm不需要计算全局平均 二.Batch Norm Ba ...
 - norm函数的作用,matlab
		
格式:n=norm(A,p)功能:norm函数可计算几种不同类型的返回A中最大一列和,即max(sum(abs(A))) 2 返回A的最大奇异值,和n=norm(A)用法一样 inf 返回A中最大一行 ...
 - MATLAB 中NORM运用
		
格式:n=norm(A,p)功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 以下是Matlab中help norm 的解释 NORM Matrix or vector ...
 - (转)几种范数的解释 l0-Norm, l1-Norm, l2-Norm, … , l-infinity Norm
		
几种范数的解释 l0-Norm, l1-Norm, l2-Norm, - , l-infinity Norm from Rorasa's blog l0-Norm, l1-Norm, l2-Norm, ...
 - matlab norm的使用
		
格式:n=norm(A,p)功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 以下是Matlab中help norm 的解释 NORM Matrix or vector n ...
 - matlab norm 范式
		
格式:n=norm(A,p) 功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 p 返回值 1 返回A中最大一列和,即max(sum(abs(A))) 2 返回A的 ...
 - Matlab norm 用法小记
		
Matlab norm 用法小记 matlab norm (a) 用法以及实例 norm(A,p)当A是向量时norm(A,p) Returns sum(abs(A).^p)^(1/p), for ...
 
随机推荐
- 【pkuwc2018】 【loj2537】 Minmax DP+线段树合并
			
今年年初的时候参加了PKUWC,结果当时这一题想了快$2h$都没有想出来.... 哇我太菜啦.... 昨天突然去搜了下哪里有题,发现$loj$上有于是就去做了下. 结果第一题我5分钟就把所有细节都想好 ...
 - 大数据技术之_19_Spark学习_04_Spark Streaming 应用解析小结
			
========== Spark Streaming 是什么 ==========1.SPark Streaming 是 Spark 中一个组件,基于 Spark Core 进行构建,用于对流式进行处 ...
 - (转)Python标准库02 时间与日期 (time, datetime包)
			
原文:http://www.cnblogs.com/vamei/archive/2012/09/03/2669426.html https://www.liaoxuefeng.com/wiki/001 ...
 - (转)Mysql备份还原数据库之mysqldump实例及参数详细说明
			
http://www.xuejiehome.com/blfl-2.html http://www.cnblogs.com/xuejie/archive/2013/01/11/2856911.html ...
 - python实现二叉树的建立以及遍历(递归前序、中序、后序遍历,队栈前序、中序、后序、层次遍历)
			
#-*- coding:utf-8 -*- class Node: def __init__(self,data): self.data=data self.lchild=None self.rchi ...
 - 解析ASP.NET Mvc开发之EF延迟加载                                                       分类:            ASP.NET             2014-01-04 01:29    4017人阅读    评论(1)    收藏
			
目录: 从明源动力到创新工场这一路走来 解析ASP.NET WebForm和Mvc开发的区别 解析ASP.NET 和Mvc开发之查询数据实例 ----------------------------- ...
 - Exceptionless搭配log4net记录日志
			
接上篇: Exceptionless 本地部署 在部署完成后可以使用log4net搭配Exceptionless来记录日志. 过程很简单,使用Nuget安装Exceptionless.Log4net, ...
 - Oracle11g常用数据字典
			
转:https://blog.csdn.net/fulq1234/article/details/79760698 Oracle数据字典的名称由前缀和后缀组成,使用_连接,含义说明如下: dba_:包 ...
 - ILSpy工具使用
			
Reflector是.NET开发中必备的反编译工具.即使没有用在反编译领域,也常常用它来检查程序集的命名规范,命名空间是否合理,组织类型的方法是否需要改善.举例说明,它有一个可以查看程序集完整名称的功 ...
 - android studio生成aar包并在其他工程引用aar包
			
1.aar包是android studio下打包android工程中src.res.lib后生成的aar文件,aar包导入其他android studio 工程后,其他工程可以方便引用源码和资源文件 ...