How to disable dropout while prediction in keras?

前端 未结 4 707
我寻月下人不归
我寻月下人不归 2021-01-03 22:30

I am using dropout in neural network model in keras. Little bit code is like

model.add(Dropout(0.5))
model.add(Dense(classes))

For testing,

4条回答
  •  Happy的楠姐
    2021-01-03 23:06

    Dropout removes certain neurons form play, and to compensate for that we usually take one of two ways.

    1. scaling the activation at test time
    2. inverting the dropout during the training phase

    And keras uses the second form of correction as you can see here

提交回复
热议问题