Lesson 3 of 12 8 min · 145 words
Loss functions
Measuring the cost of one prediction: squared, absolute, log loss.
A loss function measures the cost of a single prediction when the truth is . It turns 'how wrong' into a number the optimiser can minimise.
Squared loss — standard for regression; punishes large errors heavily and is smooth. Absolute loss — more robust to outliers. Huber loss — squared for small errors, absolute for large ones.
0–1 loss — 1 if the class is wrong, 0 otherwise; what accuracy measures, but not differentiable. Log (cross-entropy) loss — standard for classification; heavily punishes confident wrong answers. Hinge loss — used by SVMs.
Formula to remember
ERM
Pick the hypothesis with the lowest training loss.
Quick check · +5 XP