Orthogonal Projections as Conditional Expectation
Formal
Suppose we want to predict a random variable using information from another random variable (or vector of variables) . We seek a function that minimizes the Mean Squared Error (MSE):
The mathematical theorem states that the unique function that minimizes this MSE is the conditional expectation:
The Geometric Interpretation (Orthogonality)
Because random variables form a Hilbert space (see Geometry of Random Variables), we can view this purely geometrically.
- is a vector in the full space.
- The set of all possible functions of forms a subspace.
- The error of our prediction is the vector .
To minimize the length (norm) of the error vector , the error must be orthogonal to the subspace of . This is the Orthogonality Principle:
Therefore, the conditional expectation is exactly the orthogonal projection of onto the subspace spanned by .
Intuition
Imagine you are a shadow on a 2D floor (the subspace ), trying to get as close as possible to a bird flying in the 3D air above you (the target variable ).
If you stand directly beneath the bird, the distance between you and the bird is a straight vertical line. That vertical line is orthogonal (perpendicular) to the floor. Any other position on the floor would result in a longer diagonal distance.
Linear Regression is just an algorithm that finds the “shadow” of on the “floor” of .
ML Applications
- Linear Regression (OLS) — Ordinary Least Squares is the most direct application. The formula is literally the projection matrix projecting the vector onto the column space of .
- Why we use MSE — When we train a neural network with an MSE loss function, we are explicitly asking the network to approximate the conditional expectation . If we used MAE (L1 loss) instead, the network would approximate the conditional median.
- The Bias-Variance Tradeoff — represents the theoretical limit of how good a model can be (the irreducible error). Our model is just trying to approximate that projection.
Connections
- Forward Links:
- Backward Links: Orthogonal Projections, Expectation and Variance, Conditional Probability, Geometry of Random Variables