Loss Function

A formula that measures how wrong a model's predictions are during training.

Which error does the training objective emphasize?

Imagine two equally weighted jobs with duration errors of one and three hours. The same pair of predictions gives two different training scores depending on how error is turned into a penalty.

Absolute errorAbsolute lossSquared loss
1 hour11
3 hours39
Mean across jobs2 hours5 hours squared

What does a model learn to prioritize?

Under absolute loss, the larger error contributes three times the penalty of the smaller one. Under squared loss it contributes nine times as much. Selecting a loss changes the incentive placed on improving particular predictions. It also changes the units, so the raw values 2 and 5 do not rank the two approaches.

Two square ivory tiles sit on a cutting mat.
A square’s area grows faster than its side length, just as squared loss grows faster than absolute error.

Which measure belongs in the report?

Report performance in units meaningful to the user. For these jobs, root mean squared error is the square root of five, about 2.24 hours. Check that a training objective which emphasizes large misses actually reflects the costs of understaffing or overstaffing.

Follow the idea

Regression · Interpret signed and absolute residuals.

Model Evaluation · Choose evidence that reflects the user’s outcome.

Source · Google’s guide to regression loss

Return to Loss Function in the A–Z glossary