COMPLETE READING EDITION

Loss, in perspective.

All five chapters, including worked answers and static lab comparisons. This edition loads no JavaScript.

Glossary

Prediction y^\hat y
A model's proposed output. In the regression toy, y^=wx+b\hat y=wx+b.
Target yy
The output against which a prediction is evaluated. The regression targets are invented scalar values; the classification targets are labels 0 or 1.
Residual ee
Prediction minus target in this guide. Squared and absolute losses ignore its sign, but other formulas may not.
Per-example loss ℓ\ell
A penalty assigned to one prediction and its target.
Reduction
The operation combining individual losses, such as their sum or mean. A different reduction changes the numeric scale.
Objective LL
The scalar being minimized. Here it is the mean of per-example losses, without an additional regularization term.
MSE
Mean squared error: 1N∑iei2\frac1N\sum_i e_i^2 for the scalar-output examples used here. There is no one-half factor in this guide's convention.
MAE
Mean absolute error: 1N∑i∣ei∣\frac1N\sum_i|e_i|.
Huber loss
A penalty with a quadratic center and linear tails. At threshold δ=1\delta=1, the center is 12e2\frac12e^2 and the tails are ∣e∣−12|e|-\frac12.
Parameters w,bw,b
The slope and intercept of the toy prediction line. Unlike inputs and targets, these are the choices being varied to change its loss.
Loss surface
Loss as a function of parameter choices with the evaluated data fixed. Our 3D rendering uses two parameter axes and loss as height.
Parameter slice
A view of loss with one parameter held fixed while another varies. Here a fixed bias leaves a minimum slice loss of (b−1)2(b-1)^2.
Gradient ∇L\nabla L
The vector of partial derivatives of loss with respect to the parameters, describing local sensitivity.
Learning rate η\eta
The step-size multiplier in a gradient update. An overly large step can increase loss.
Training-loss curve
A record of loss over optimization updates or epochs. Its horizontal axis is not the same as a residual axis, parameter axis, or candidate learning-rate axis.
Binary cross-entropy
The negative natural logarithm of the probability assigned to the observed binary label. The guide uses the theoretical scalar formula and endpoint limits.
Accuracy
The fraction of predicted labels that match the targets. A probability-to-label decision rule must be specified separately.
Generalization
Performance beyond the training examples. Training loss alone is insufficient evidence; held-out evaluation has its own sampling and use assumptions.

Sources

  1. PyTorch 2.8 — MSELoss

    Squared-loss definition and mean/sum reductions. Our scalar-output toy uses a mean with no half factor; this is a pinned version, not a claim about the latest release.

  2. PyTorch 2.8 — L1Loss

    Absolute-loss definition and reductions. The discussion of the corner and slopes follows directly from its absolute-value formula.

  3. PyTorch 2.8 — HuberLoss

    Piecewise loss and threshold parameter. Our comparison sets delta to 1 and preserves the quadratic branch’s one-half factor.

  4. Deep Learning — Chapter 4: Numerical Computation

    Goodfellow, Bengio, and Courville (2016), §4.3, equation 4.5, figure 4.4, and equation 4.9. Gradient descent, step size, and local curvature; no universal learning-rate recommendation is inferred.

  5. Deep Learning — Chapter 8: Optimization for Training Deep Models

    §8.1 separates the per-example loss, empirical objective, and generalization concerns; §8.2.2 discusses nonconvex neural-network objectives. The toy bowl is not presented as a generic network landscape.

  6. scikit-learn 1.7.2 — log_loss

    Binary log-loss formula and natural-log convention. The documented API clips probabilities; the companion instead preserves theoretical endpoint limits.

  7. PyTorch 2.8 — BCELoss

    Discussion of logarithmic endpoints and log-output clamping. This distinction prevents confusing the guide’s infinite theoretical endpoint with a library safeguard.

  8. scikit-learn 1.7.2 — accuracy_score

    Fraction-correct accuracy definition. The transfer example supplies its own explicit positive-probability threshold of 0.5.

  9. scikit-learn 1.7.2 — Cross-validation: evaluating estimator performance

    Opening discussion of overfitting, validation, and a separate test set. The guide contains no measured generalization result.