aNet.ai
Machine Learning/Learning path
0day streak0XP · Lv 1
← 4. Learning as an Optimization Problem
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

SGD with batch size 1 compared to full-batch GD is…

Practice this topic
Saved in this browser as you type.
aNet.ai · Introduction to Machine Learning · NewUU course outlineProgress saved in this browser