Skip to content

Training loss

Training loss measures fit to training observations. Read mean versus sum, squared-error units and penalty conventions without mistaking in-sample fit for future forecasting skill.

Training loss is the value of a chosen loss function evaluated on the observations used to fit a model. It measures how well the model matches its training examples under that criterion. For a quant forecasting returns, a falling training loss means a better fit to the historical targets being optimised; it does not establish better forecasts on newly arriving market data.
The loss function supplies the scoring rule, such as squared prediction error. The training set specifies the observations on which that rule is evaluated. Both are needed to interpret the number.

Two targets, one constant forecast

Take two synthetic training rows with distinct inputs, A and B. Their targets are one-day returns of 1 and 3 basis points. A constant rule predicts 2 basis points for each. These are stipulated values to illustrate the accounting, not forecasts produced by a trained model.
Training rowTarget (bps)Prediction (bps)Prediction minus target (bps)Squared error (bps²)
A12+11
B32−11
Here the training mean squared error, with no factor of one-half, is
Ltrain=(2−1)2+(2−3)22=1 bps2.L_{\mathrm{train}}=\frac{(2-1)^2+(2-3)^2}{2}=1\ \text{bps}^2.
The sum of squared errors is 2 bps²; the mean is 1 bps². The root mean squared error is 1 basis point, which restores the target's units. MSE is not a return, a percentage of correct predictions or a trading loss in currency.

An unrestricted lookup rule could instead store A → 1 and B → 3. It would achieve zero squared error on these two rows. That reduction from 1 to 0 bps² says nothing by itself about an unseen row: the example supplies neither a future target nor a rule for forecasting it. Distinct inputs matter—identical inputs with conflicting targets cannot both be matched by a single deterministic prediction.

Synthetic training targets 1 and 3 bps and constant predictions 2 bps give errors +1 and −1 bps, SSE 2 bps² and MSE 1 bps². Lookup matches both for training MSE 0; no unseen outcomes are evaluated.
Synthetic training targets 1 and 3 bps and constant predictions 2 bps give errors +1 and −1 bps, SSE 2 bps² and MSE 1 bps². Lookup matches both for training MSE 0; no unseen outcomes are evaluated.
Original synthetic ledger. Targets and predictions are one-day returns in basis points; both loss scores concern only the two training rows.

The convention is part of the score

For n>0n>0 equally weighted training examples, with target yiy_i and prediction fθ(xi)f_\theta(x_i), a mean prediction loss is

Ltrain(θ)=1n∑i=1nℓ(yi,fθ(xi)).L_{\mathrm{train}}(\theta)=\frac{1}{n}\sum_{i=1}^{n}\ell\bigl(y_i,f_\theta(x_i)\bigr).
The individual loss ℓ\ell need not be squared error. Classification commonly uses log loss; regression may use absolute error or Huber loss. A numerical value cannot be compared across different loss definitions as if it measured the same thing. The owned lesson Output Layers, Activation Functions, and Loss Functions explains how the prediction task determines the output constraints and suitable loss. Its preview is public; the full lesson requires membership.

Record the reduction (sum or mean), target scaling, sample weights and evaluation sample. A weighted mean also needs its denominator: dividing by total weight differs from dividing by observation count. A mean over one minibatch is not automatically the loss over the whole training set. A training log that averages batch scores while parameters change need not equal a fresh evaluation of the final fitted model on all training rows.

Prediction loss versus the optimisation objective

Some systems use “training loss” for a total objective that includes a regularisation penalty. Make that inclusion explicit:

J(θ)=Ltrain(θ)+λP(θ),λ≥0.J(\theta)=L_{\mathrm{train}}(\theta)+\lambda P(\theta),\qquad\lambda\ge0.

Here PP penalises a property of the parameters; it is not another realised forecast error. A change in JJ can reflect a change in prediction fit, the penalty, or both. Report the components separately when comparing models. With dimensional targets, the coefficient and penalty scaling must make the terms compatible.

Changing a mean prediction loss to a sum multiplies that component by nn. Keeping the same numerical penalty coefficient changes its relative strength. Multiplying the entire objective by nn preserves its minimisers, although it scales gradients and can require a different gradient-descent step size. This is why “sum versus mean makes no difference” needs a convention and a context.

What the score can tell a trading researcher

Training loss is useful for diagnosing optimisation and checking whether a model can fit its assigned task. It cannot certify generalisation. Overfitting can improve the training score while failing to capture a stable predictive relationship. Conversely, a nonzero training score is compatible with a useful model when targets contain noise or regularisation deliberately limits fit.
Keep later validation and final test observations outside their respective fitting and selection decisions. For financial data, enforce when each feature and completed target became available; a row's date alone is insufficient. Time-Ordered Train, Validation and Test Design develops that learning schedule and the separate roles of fitting, selection and final assessment. It has a public preview and requires membership for the full lesson.
Finally, forecast loss and trading performance answer different questions. Even a credible reduction in held-out prediction error must be connected to positions, execution, transaction costs and risk before making an economic claim. A low training score supplies none of that accounting.

Sources

  • Zhang, A., Lipton, Z. C., Li, M. and Smola, A. J., Dive into Deep Learning, §3.1.1.2: Loss Function. Squared-error and averaging conventions; that text uses a one-half factor, whereas this example does not.
  • The same authors, §3.6.1: Training Error and Generalization Error. Empirical versus population error and why fitting the training sample alone is insufficient.
  • The same authors, §3.7.1: Norms and Weight Decay. Additive penalties and their relative strength.
  • Goodfellow, I., Bengio, Y. and Courville, A., Deep Learning, §§5.2 and 5.2.2, printed pp. 110–119. Local text consulted for training versus generalisation error and the penalised objective. The targets, ledger and figure above are original synthetic illustrations.
Last updated
  • machine learning
  • loss functions
  • model training
  • forecast evaluation
← Back to the glossaryBack to top ↑