06
5 minute interactive lab

Loss functions

How does a model know how wrong it is?

YOU’LL LEAVE KNOWINGLoss converts a goal into a number learning can optimize.
THE EXPERIMENT

Turn a wrong prediction into useful feedback.

Move the controls. Watch the internal state respond. The explanation follows the behavior—not the other way around.

Runs the real small-scale equationThe displayed values are calculated from the formula shown in this lesson.
OBJECTIVEMeasure how wrong

The prediction and target are identical across all three rows. Only the definition of “wrong” changes.

Squared error0.078

Squares the miss, emphasizing large errors.

Absolute error0.280

Treats every unit of error equally.

Cross-entropy0.329

Penalizes confident wrong classifications.

THE MENTAL MODEL

Loss converts a goal into a number learning can optimize.

A loss function measures a prediction against the target. Different losses encode different priorities: squared error punishes large misses, while cross-entropy strongly penalizes confident wrong classifications.

IN DEVELOPER TERMSloss = measure(prediction, target)
GO DEEPER

Check the model against the source.

Connectionism optimizes for intuition, then points you to the rigorous treatment.

  1. Dive into Deep LearningLoss functions
  2. Google ML Crash CourseLoss
NEXT CONNECTION

Which way should every weight move?

Gradient descent

Continue to lab 07