Definition
Loss
A loss function assigns a non-negative cost to a prediction on one example. For an input space , a label space , a prediction space , and a predictor , it is a function
where measures how bad the prediction is when the true label is . A loss function evaluates one prediction; a risk averages that loss over a data distribution or a training sample.
Role in learning
In supervised learning, the loss turns prediction quality into an optimisation objective. A hypothesis is preferred when it has smaller expected loss:
On a finite training set , this is approximated by the empirical average
Different losses ask different questions. Zero-one loss asks only whether the predicted label is wrong. Cross-entropy loss asks how much probability the model assigned to the true label. Quadratic loss asks how far a numerical prediction is from a numerical target, with large residuals punished more strongly.