Skip to content
Lambdian

Cross-entropy (log-loss)

The loss for probabilistic classifiers: it heavily penalises confident wrong predictions.

For binary labels with predicted probability pp:

L=−[ylog⁡p+(1−y)log⁡(1−p)]L = -\big[y\log p + (1-y)\log(1-p)\big]

For KK classes it is −log⁡-\log of the probability given to the true class. Predicting the right class with probability 0.99 costs almost nothing; predicting it with 0.01 costs a lot. Minimising cross-entropy is the same as maximum likelihood, and it is the standard output loss of logistic regression and neural-network classifiers (usually with a softmax).

See it in action