machine-learning classification learning-theory
Definition
Zero-One Loss
Zero-one loss is the loss function for classification that charges one unit for a wrong label and zero units for a correct label.
For a classifier , an input , and a true label , it is defined by
Equivalently, using an indicator function,
Zero-one loss records only whether the prediction is correct. It does not care how confident the classifier was, how close the decision was, or which wrong label was chosen.
Risk
For a data-generating distribution over pairs , the true risk under zero-one loss is the probability of misclassification:
For a training dataset , the empirical risk is
This is exactly the observed misclassification rate on the sample. Its complement is accuracy:
Optimisation Difficulty
Zero-one loss is the evaluation target one often cares about, but it is hard to optimise directly. As a function of model parameters, it is usually flat over large regions and jumps only when a point crosses a decision boundary.
This makes it non-differentiable and poorly suited for gradient-based optimisation. Small parameter changes often give no training signal at all. This is why practical classifiers usually optimise a smooth surrogate loss, such as cross-entropy loss or hinge loss, and then report zero-one loss or accuracy as an evaluation metric.
The key mismatch is:
A surrogate may be easier to optimise, but minimising it need not minimise zero-one loss exactly.