Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras Dropout Layer Model Predict

The dropout layer is only supposed to be used during the training of the model, not during testing.

If I have a dropout layer in my Keras sequential model, do I need to do something to remove or silence it before I do model.predict()?

like image 271
c19ut Avatar asked Oct 28 '25 13:10

c19ut


1 Answers

No, you don't need to silence it or remove it. Keras automatically takes care of it.

It is clearly mentioned in the documentation. A Keras model has two modes:

  1. training
  2. testing

Regularization mechanisms, such as Dropout and L1/L2 weight regularization, are turned off at testing time.

Note: Also, Batch Normalization is a much-preferred technique for regularization, in my opinion, as compared to Dropout. Consider using it.

like image 142
Abhishek Saxena Avatar answered Oct 30 '25 15:10

Abhishek Saxena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!