Maximum Likelihood & Least Squared Error
Source: Unit 3 §7
The result
Under certain assumptions, any learner that minimises the squared error between its predictions and the training data outputs the maximum likelihood hypothesis .
This has already happened repeatedly without being named: neural networks, linear regression and polynomial curve fitting all minimise the sum of squared errors. Each of them is, silently, doing maximum likelihood estimation under a Gaussian noise model.
The derivation
Setup. A learner learns a target . The training data is noisy: each example satisfies
where is Gaussian noise with mean 0. Assume all hypotheses are equally probable a priori, so MAP reduces to ML. Because is Normal, is Gaussian with mean .
- Start from the definition and use independence across examples: , a product of Gaussian densities.
- Take the log. Maximising of a product is maximising the sum of logs, and is monotone so the argmax is unchanged. This is the standard ML trick.
- Drop the constant term - the Gaussian's normalising factor is independent of and cannot change the argmax.
- What is left is a negative quantity: minus the sum of squared residuals over . Maximising a negative quantity is minimising the positive one, which is the exponent's squared term.
That is exactly the least-squared-error hypothesis.
The same argument run with a different noise model gives a different loss. The ML hypothesis for predicting probabilities is the one that minimises cross-entropy loss. Squared error and cross-entropy are the same idea under two different assumptions about how the data was generated.
The equivalence needs zero-mean Gaussian noise on the target values only and a uniform prior over hypotheses. Noise on the inputs , or a non-Gaussian error distribution, breaks the derivation, and squared error stops being the maximum likelihood objective.