Mean squared error (MSE) measures prediction quality by averaging squared differences between predicted and ground-truth values. Squaring removes the sign, so overestimates and underestimates with equal magnitude receive equal error; larger deviations receive disproportionately larger penalties. section 2.5.4 section 8.6
A one-value comparison
For a target of 2, predictions of 1.5 and 2.5 both produce squared error (prediction − target)^2 = 0.25. A model producing exactly its target receives error 0, while a prediction of 5.51 for target −0.8 produces squared error 39.82. The metric therefore compares parameter choices by how closely their outputs match the targets. section 2.5.4 section 2.5.4
Use MSE as the loss signal in supervised model training:
- Compute each prediction from an input, compare it with the known ground truth, and aggregate the individual squared errors across the training data. section 1.3.5
- Adjust weights and biases iteratively so the loss decreases; neural-network training connects this loss to gradients from backpropagation. section 8.4.6 section 8.6
- Interpret a low training loss as close agreement on the training examples, while remembering that training error is distinct from performance on unseen data. section 1.3.5 section 8.6
Algorithm 8.5 Training a neural network
| Initialize while 𝕃 > threshold do ⊳ Forward pass for l ← 0 to L do end for ⊳ Loss 𝕃 = 1/2 || ⊳ Gradients for the last layer ▽W(L)𝕃 = ▽b(L)𝕃 = ⊳ Gradients for the remaining layers for l ← L – 1 to 0 do ▽W(l)𝕃 = ▽b(l)𝕃 = end for ⊳ Parameter update W = W – r▽W𝕃 b = b – r▽b𝕃 end while |
Trace MSE through a complete neural-network loop: forward pass, loss computation, backpropagated gradients, and weight and bias updates. section 8.4.6












