Skip to content
Lambdian

Loss function

A number that measures how wrong a model's predictions are; training means making it small.

A loss function turns "how wrong is the model?" into a single number to minimise. The choice depends on the task:

  • Mean squared error for regression.
  • Cross-entropy (log-loss) for classification with probabilities.
  • Hinge loss for support vector machines.
  • Huber or absolute error when outliers should count less.

The loss you train on and the metric you report (accuracy, F1, RMSE) need not be the same: losses must be smooth enough to optimise, metrics must reflect what the business cares about.

See it in action