A loss measures how wrong a prediction is for a target .

  • Mean squared error (regression): .
  • Cross-entropy (classification): .

Minimising MSE is maximum likelihood under Gaussian noise (see distributions); minimising cross-entropy is maximum likelihood for a categorical model.

The loss must be differentiable almost everywhere so that gradient-descent can use its gradients. Adding a penalty term gives regularisation.