关于CNN中dropout的一些要点

dropout层的作用是防止训练的时候过拟合。在训练的时候,传统的训练方法是每次迭代经过某一层时,将所有的结点拿来做参与更新,训练整个网络。加入dropout层,我们只需要按一定的概率(retaining probability)p 来对weight layer 的参数进行随机采样,将被采样的结点拿来参与更新,将这个子网络作为此次更新的目标网络。这样做的好处是,由于随机的让一些节点不工作了,因此可以避免某些特征只在固定组合下才生效,有意识地让网络去学习一些普遍的共性(而不是某些训练样本的一些特性)这样能提高训练出的模型的鲁棒性。

  • Dropout只发生在模型的训练阶段,预测、测试阶段则不用Dropout
  • 直观认识:Dropout随机删除神经元后,网络变得更小,训练阶段也会提速
  • 事实证明,dropout已经被正式地作为一种正则化的替代形式
  • 有了dropout,网络不会为任何一个特征加上很高的权重(因为那个特征的输入神经元有可能被随机删除),最终dropout产生了收缩权重平方范数的效果
  • Dropout的功能类似于L2正则化,但Dropout更适用于不同的输入范围
  • 如果你担心某些层比其它层更容易过拟合,可以把这些层的keep-prob值设置的比其它层更低
  • Dropout主要用在计算机视觉领域,因为这个领域我们通常没有足够的数据,容易过拟合。但在其它领域用的比较少
  • Dropout的一大缺点就是代价函数不再被明确定义,所以在训练过程中,代价函数的值并不是单调递减的

 

tensorflow: what's the difference between tf.nn.dropout and tf.layers.dropout

I'm quite confused about whether to use tf.nn.dropout or tf.layers.dropout.

many MNIST CNN examples seems to use tf.nn.droput, with keep_prop as one of params.

but how is it different with tf.layers.dropout? is the "rate" params in tf.layers.dropout similar to tf.nn.dropout?

Or generally speaking, is the difference between tf.nn.dropout and tf.layers.dropout applies to all other similar situations, like similar functions in tf.nn and tf.layers.

The only differences in the two functions are:

  1. The tf.nn.dropout has parameter keep_prob: "Probability that each element is kept"
    tf.layers.dropout has parameter rate: "The dropout rate"
    Thus, keep_prob = 1 - rate as defined here
  2. The tf.layers.dropout has training parameter: "Whether to return the output in training mode (apply dropout) or in inference mode (return the input untouched)."

 

 

参考:

https://blog.csdn.net/u014696921/article/details/53698745

https://blog.csdn.net/ybdesire/article/details/79477808

https://stackoverflow.com/questions/44395547/tensorflow-whats-the-difference-between-tf-nn-dropout-and-tf-layers-dropout

你可能感兴趣的:(deep,learning)