Training

Loss function

A loss function converts prediction error into a scalar training objective.

predictionlosssquared errortrue value
A loss function converts prediction error into a scalar training objective. Values shown in the worked visual are illustrative unless the labels state otherwise.

How it works

Optimization follows the loss gradient, so the loss defines what behavior training rewards. Different losses encode different assumptions about errors.

A concrete example

Illustrative: predicted class probability 0.8 gives cross-entropy loss -ln(0.8) ≈ 0.223.

Do not confuse it with Metric

loss drives parameter updates; a metric reports behavior for interpretation.

Study the full lesson