第一周 深度学习的实用层面
一般训练集和测试集比例是 7:3 or 6:2:2,但是在大数据时代(数据超过百万)我们可以将测试集和交叉验证集的比例缩小。甚至可以是98:1:1,超过百万的,可以99.5:0.25:0.25.
并且训练集和测试集的数据要服从同一分布!

图一不能很好拟合数据,underfitting,图三over fitting

这里提到了个optimal error,就是用人眼来辨别,当作误差的基准。



为什么L2正则项可以防止过拟合呢?当λ变大,则w(权重矩阵)的某些值就变成了0,这意味着模型将从high variance过渡到high bias。下图使用了个更明显的激活函数来阐述这个问题。

drop out(随机失活)正则。在网络中每一个节点都以0.5的概率选择删去或者保留该节点,最后会得到一个不是那么大的网络,虽然方法很简单,但是它的确有用。

dropout和L2正则化很像,通常用在计算机视觉方向,因为数据过少,很容易引起过拟合。我们可以在容易发生过拟合的层时(节点数目过大)时将keep prob值设置的小点,不同的层可以使用不同数值的keep prob.它的缺点是破坏了损失函数J

还有一些其他的正则化方法。比如说数据扩增:1.将图片反转加到数据集里,将图片旋转,放大,将数字扭曲变形等,2.early stopping,可以绘制出dev-set train-set的损失函数J曲线,并选择合适的时候停止梯度下降,缺点是J不能得到很好的优化,没有到足够低,并且一个时刻做了两件事,有点伤。

归一化输入


在层数很多的神经网络中,很容易发生梯度消失和梯度爆炸


双边误差比单边更加准确,所以梯度校验时采用2e来做。

梯度校验some tips:


第二周 优化算法
Mini -batch





指数加权平均


动量梯度下降






第三周:超参数调试

不要使用网格,因为不同的参数有不同的重要性,随机取值,α能够取到更多的值,可能会取到更好效果的值。当搜索时,可以先搜索大范围的,然后再缩小范围搜索。~

在对数轴上取数~。有点技巧。


超参数的搜索过程,当然~要视应用而定。

归一化输入,使训练加快惹,上边是逻辑回归时用方差归一化输入

Batch归一化:对隐藏层进行归一化,而且不仅仅使用方差和均值,还加入了参数使得可以任意调节

注意。batch norm是在计算激活函数前就要归一化的

用mini-batch与batch norm结合在一起。可以把b参数去掉

batch norm的作用~!减少covariate shift的影响,whichmeans 前层参数的变化会影响后面的训练。每一层都归一化后,可以使得参数shift的不那么快,有助于加速训练、而且还带来了一点意想不到的作用“正则化~”


softmax归一化:处理最后分类结果是多分类的

网友评论