One dot product makes one prediction
Put observations in the rows of a data matrix . A weight vector tells us how strongly each feature contributes. The matrix product computes all the predictions:
If has rows and columns, has entries and has entries—one prediction per observation.
Compare the prediction arrow with the target arrow
The targets form another vector, . The difference is the residual vector. Its coordinates record the prediction errors, including their signs.
Suppose and . The residual is . Squaring and adding gives . Average across the two observations:
This is mean squared error. Geometrically, it is the squared distance between the prediction and target vectors, divided by the number of observations. Perfect predictions make the arrows coincide and the residual zero.
Learning changes the weights
Changing moves within the column space of . Training searches for weights that reduce the loss. Gradient descent takes a small step opposite the loss gradient:
Backpropagation computes gradients through a network; an optimizer uses them to update parameters. Lower training loss measures a better fit to the training examples. Performance on new examples needs its own evaluation.
Read a prediction correctly
Is a raw entry of necessarily a probability?
Answer: No. It is a real-valued score. A probability model needs an appropriate output mapping and training objective.
