Empirical objectives
An empirical objective is the average stated loss over all examples in a fixed dataset.
On this page 7 sections
01A loss for the whole dataset#
An empirical objective summarizes how a model performs on a fixed dataset. First calculate a loss for every example using the same rule. Then average those losses. Changing the parameters changes the losses and therefore the objective.
At one parameter setting, three examples have losses . Their total is , and the dataset contains three examples. The empirical average is .
Writing the parameter vector as and example 's loss as gives
Each example contributes once, even if several losses have the same value.
Losses: . Find their empirical average.
Show answer and explanation
Sum over examples: .
02Loss first, average second#
Suppose predictions are and targets are . The residuals are and . Under half-squared loss, each example contributes , giving mean loss .
Averaging residuals first would give zero, then squaring would give zero. That would hide both errors. The order of operations is part of the objective's definition.
Targets: ; predictions: . Each loss is . Find the mean loss.
Show answer and explanation
Per-example losses: 4.5, 2. Their average is .
03State the convention#
Squared loss and half-squared loss differ by a factor of two. Summed loss and mean loss differ by the number of examples. Read the stated convention before calculating.
Repeating the entire dataset leaves its mean loss unchanged: both numerator and denominator double. Repeating only its hardest example changes that example's weight and usually changes the mean.
Losses: . A draft divides the sum by 3 distinct losses. Correct the average.
Show answer and explanation
Sum over examples: .
A zero-loss example still belongs in the denominator. Averaging batch averages equally works only when the batches have equal size; otherwise weight each average by its number of examples.
This objective describes the observed dataset. Expected loss describes a probability model for new examples. Treating the empirical average as an estimate of that expectation requires assumptions about how the data were collected. Model evaluation checks that connection separately.
Compute every loss with its stated convention, sum them and divide by the actual example count.
- Form an average per-example loss over a fixed dataset.
Sources & further reading
- [1]Dive into Deep Learning §12.5.2 ↗d2l.ai · Article
- [2]Stanford CS229, Main Notes, Part I §1 ↗cs229.stanford.edu · Article
- [3]Dive into Deep Learning, §2.6 Probability and Statistics ↗d2l.ai · Article