本文介绍了TensorFlow MNIST 教程中的 keep_prob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解 面向专家的深度 MNIST 教程.

train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})

运行train_stepkeep_prob: 0.5的目的是什么?

What is the purpose of keep_prob: 0.5 when running train_step?

推荐答案

keep_prob 值用于控制 dropout rate 用于训练神经网络.本质上,这意味着层之间的每个连接(在这种情况下在最后一个密集连接层和读出层之间)在训练时只会以 0.5 的概率使用.这减少了过度拟合.有关辍学理论的更多信息,您可以查看 Srivastava 的原始 论文等.要了解如何在 TensorFlow 中使用它,请参阅 tf 上的文档.nn.dropout() 运算符.

The keep_prob value is used to control the dropout rate used when training the neural network. Essentially, it means that each connection between layers (in this case between the last densely connected layer and the readout layer) will only be used with probability 0.5 when training. This reduces overfitting. For more information on the theory of dropout, you can see the original paper by Srivastava et al. To see how to use it in TensorFlow, see the documentation on the tf.nn.dropout() operator.

keep_prob 值通过占位符输入,以便相同的图可用于训练(keep_prob = 0.5)和评估(keep_prob= 1.0).处理这些情况的另一种方法是构建不同的图用于训练和评估:查看当前 convolutional.py 模型示例.

The keep_prob value is fed in via a placeholder so that the same graph can be used for training (with keep_prob = 0.5) and evaluation (with keep_prob = 1.0). An alternative way to handle these cases is to build different graphs for training and evaluation: look at the use of dropout in the current convolutional.py model for an example.

这篇关于TensorFlow MNIST 教程中的 keep_prob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 02:15