machine-learning statistics optimisation
Definition
Cross-Entropy Loss
Cross-entropy loss is a loss function for probabilistic classification models. It measures how much probability the model assigns to the labels that actually occur.
Let be the target probability distribution over labels and let be the model’s predicted distribution. The cross-entropy from to is
For a single training example with true label , this becomes the negative log-probability assigned to the correct class:
Thus cross-entropy loss is small when the model assigns high probability to the correct label, and large when it assigns low probability to the correct label.
Interpretation
Cross-entropy is the expected surprise under the true distribution when outcomes are encoded using the model distribution. If the model says the observed label was likely, the loss is small. If the model says the observed label was unlikely, the loss is large.
This makes it a natural training objective for probabilistic classifiers: the model is not only asked to choose the right class, but to place probability mass on it.
Relation to KL Divergence
Cross-entropy decomposes as
where is the entropy of the target distribution and is the Kullback–Leibler divergence from to .
When is fixed, minimising cross-entropy in is therefore equivalent to minimising .
Binary Case
For binary classification, cross-entropy becomes binary cross-entropy loss. With true label and predicted conditional probability , it is
This is the standard loss for logistic regression and binary neural classifiers with a sigmoid output.
Maximum Likelihood
Minimising cross-entropy over a dataset is equivalent to maximising the likelihood of the observed labels under the model’s predicted distributions.
For independent examples , minimising
maximises the probability that the model assigns to the observed label sequence.