A loss function defines which prediction errors matter. Compare squared and absolute penalties, their units, and the distinction between model fit and trading profit.
Loss function
A loss function assigns a numerical penalty to a prediction and its realised target. It specifies what counts as an expensive error. In quantitative finance, choosing the loss can change which return forecast a model learns, which bad forecasts receive the most attention, and which model wins an evaluation.
The loss is part of the modelling question. A forecast of the average future return, a forecast of a downside quantile and a probability of default answer different questions; they need not share the same penalty. A low loss is evidence about that specified prediction task, not a trading profit.
One error becomes a training objective
Write yi for the realised target and y^i=fθ(xi) for a model's prediction from featuresxi. The per-observation loss is L(yi,y^i). A common training objective is its unweighted sample mean:
J(θ)=n1i=1∑nL(yi,fθ(xi)).
The fitting algorithm searches for parameters that reduce this objective. Gradient descent, when applicable, uses its derivatives; the optimiser is a method for searching, while the loss defines the penalty being searched over. Observation weights can change whose errors matter most. Regularisation can add a parameter or complexity penalty to the objective, separate from prediction loss.
Terminology varies: “loss” is also used for the whole aggregate objective. Check whether a reported value is a sum, a mean, a weighted mean, or includes regularisation before comparing it with another result.
The same forecasts, different penalties
Consider two synthetic one-day return targets, recorded numerically in basis points. Define residual as prediction minus target. These are supplied forecasts, not the output of a fitted model.
With absolute-error loss, L(y,y^)=∣y^−y∣, the mean absolute error is
MAE=21+2=1.5bp.
Doubling the error magnitude gives four times the squared penalty but only twice the absolute penalty. Squared loss therefore gives large residuals greater relative influence. Neither of these symmetric losses distinguishes overprediction from underprediction of the same magnitude.
Synthetic residuals minus 1 and plus 2 basis points have squared losses 1 and 4 bp squared and absolute losses 1 and 2 bp. MSE is 2.5 bp squared; MAE is 1.5 bp.
Original analytic loss curves with the two synthetic residuals marked. The vertical axes have different units; their numerical heights are not a ranking of loss functions.
The target and MAE have units of basis points; MSE has squared basis-point units. Calling 1.5 “better than” 2.5 here compares different quantities. Even for the same loss, compare models on the same eligible observations, target definition, horizon, weights and unit convention. Converting returns from basis points to decimal returns changes the reported scale of these losses.
Choose what the prediction should estimate
Loss choice changes the ideal prediction even before an optimiser enters the picture. At the population level, minimising expected squared error over unrestricted point predictions gives the conditional mean, assuming a finite second moment. Minimising expected absolute error gives a conditional median, assuming a finite first absolute moment; a median need not be unique. A constrained model class or finite training sample need not attain either ideal.
This distinction matters for skewed financial outcomes. A desk asking for an expected cash flow should not silently substitute a median cash flow because absolute error happens to be less sensitive to extreme observations. Conversely, large residuals are not automatically bad data: they may represent the very stress outcomes the research needs to retain.
The Probabilistic Interpretation of Least Squares lesson derives squared loss from an independent Gaussian noise model and contrasts it with the absolute loss implied by Laplace noise. A public preview is available; the full lesson requires membership. The mean-minimisation result itself does not require Gaussian outcomes.
For binary probability forecasts, log loss instead scores the probability assigned to the observed outcome. It penalises confident wrong predictions heavily and is dimensionless. The Logistic Regression and Maximum Likelihood lesson derives it from a Bernoulli likelihood; its full text requires membership and has a public preview.
Finally, distinguish fitting, forecast evaluation and trading evaluation. Lower training loss can accompany overfitting. Assess forecasts on appropriately separated, chronologically valid out-of-sample data. Then evaluate the trading policy that turns forecasts into positions, including feasible execution, sizing, risk and transaction costs. A prediction loss does not contain those economic choices unless they have explicitly been built into its definition.
Sources
Hastie, Tibshirani and Friedman, The Elements of Statistical Learning, second edition, corrected twelfth printing (January 2017), §2.4, pp.18–20. Expected prediction loss, conditional mean under squared loss, and conditional median under absolute loss. Authors' book page.