测试/训练阶段 Dropout 层的行为

Behavior of Dropout layers in test / training phase

根据 Keras 文档,dropout 层在训练和测试阶段表现出不同的行为:

Note that if your model has a different behavior in training and testing phase (e.g. if it uses Dropout, BatchNormalization, etc.), you will need to pass the learning phase flag to your function:

不幸的是,没有人谈论实际的差异。为什么辍学在测试阶段会有不同的表现?我希望该层将一定数量的神经元设置为 0。为什么这种行为取决于 training/test 阶段?

训练阶段使用Dropout来降低过拟合的几率。正如你提到的,这一层会停用某些神经元。该模型将变得对其他节点的权重更加不敏感。基本上,使用 dropout 层后,经过训练的模型将是许多细化模型的平均值。查看更详细的解释here

但是,在应用经过训练的模型时,您希望使用模型的全部功能。您想使用经过训练的(平均)网络中的所有神经元来获得最高准确度。