For some context, I shall outline my current understanding:

Considering a Neural Network, for a Binary Classification problem, the Cross-entropy cost function, J, is defined as:

$ J = \frac{-1}{m} \sum_{i=1}^m y^i*log(a^i) + (1-y^i)*log(1-a^i) $

  1. m = number of training examples
  2. y = class label (0 or 1)
  3. a = output prediction (value between 0 and 1)

Dropout regularisation works as follows: For a given training example, we randomly shut down some nodes in a layer according to some probability. This has the effect of keeping the weights low during training and hence regularises the network and prevents overfitting.

I have learnt that if we do apply dropout regularisation, the cross entropy cost function is no longer easy to define due to all the intermediate probabilities. Why is this the case? Why doesn't the old definition still hold? As long as the network learns better parameters, won't the cross entropy cost decrease on every iteration of Gradient Descent? Thanks in advance.

  • $\begingroup$ Cross entropy is always defined between two distributions, in this case "predictions" and "true labels" - nothing changes about the expression. You probably need to explain a bit more what you mean by "I have learnt that if we do apply dropout regularisation, the cross entropy cost function is no longer easy to define due to all the intermediate probabilities." to get an answer going beyond this... $\endgroup$ Oct 25, 2019 at 7:32
  • $\begingroup$ I understand that the expression itself doesn't change. What I mean to ask is, is it sensible to use this particular evaluation of the cost when we use dropout regularisation? Or should the expression be modified to account for the probabilities? I am following deeplearning.ai's lectures on Coursera and Andrew Ng mentions that if we apply dropout, we can't plot the decrease in cost function(J) vs number of iterations of Gradient Descent as J is difficult to define in this case. He doesn't really go into further details, which is why I have posted this question. $\endgroup$
    – Nitin
    Oct 25, 2019 at 8:29
  • $\begingroup$ I am not familiar with this particular course, but people use the same cross-entropy loss regardless of dropout. $\endgroup$ Oct 25, 2019 at 9:31

1 Answer 1


Dropout does not change the cost function, and you do not need to make changes to the cost function when using dropout.

The reasoning is that dropout is a way to average over an ensemble of each of the exponentially-many "thinned" networks resulting from dropping units randomly. In this light, each time you apply dropout and compute the loss, you're computing the loss that corresponds to a randomly-selected thinned network; collecting together many of these losses reflects a distribution of losses over these networks. Of course, the loss surface is noisier as a result, so model training takes longer. The goal of training the network in this way is to obtain a model that is averaged over all of these different "thinned" networks.

For more information, see How to explain dropout regularization in simple terms? or the original paper: Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, Ruslan Salakhutdinov, "Dropout: A Simple Way to Prevent Neural Networks from Overfitting", Journal of Machine Learning Research, 2014.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.