← All notes · ML revision (DA5400)
Goodness of the Maximum Likelihood Estimator
Because the labels are random, $\hat w_{\text{ML}}$ is random too: a different draw of noise gives a different estimate. Measure its quality by the average squared distance to the true $w$. The answer, $\sigma^2\,\operatorname{tr}\big((XX^\top)^{-1}\big)$, depends on the noise and on the features, and the feature part is something we might be able to improve.
Source: this lecture on YouTube (≈12 min). Previous: L33 · Next: L35.
1 · Recap
Model: $y\mid x=w^\top x+\epsilon$, $\epsilon\sim\mathcal N(0,\sigma^2)$, so $y\mid x\sim\mathcal N(w^\top x,\sigma^2)$. Maximum likelihood gave
$$\hat w_{\text{ML}}=(XX^\top)^{+}Xy,$$the same $w^\star$ as least squares (L33). Now: how good a guess for the true $w$ is it?
2 · The estimator is a random variable
- $\hat w_{\text{ML}}$ is the solution of an optimisation problem that involves the data, and the labels $y_i=w^\top x_i+\epsilon_i$ are random. So $\hat w_{\text{ML}}$ is a function of random quantities, hence random. (Nothing is assumed about how $x$ is generated; the features are treated as given.)
- On an unlucky day the noise values $\epsilon_i$ are large, the labels carry little information about $w$, and the estimate is poor. So we can't judge the estimator from a single dataset.
- Instead we ask how it performs on average, over all the datasets the noise could have produced.
3 · Measuring goodness: mean squared error
Both $\hat w_{\text{ML}}$ and $w$ live in $\mathbb R^d$, so measure their squared Euclidean distance, and average over the randomness in $y$:
$$\text{MSE}(\hat w_{\text{ML}})=\mathbb E\Big[\,\lVert\hat w_{\text{ML}}-w\rVert^2\,\Big].$$4 · The answer
The lecture states the result without derivation (it's a short algebraic exercise, done in the note below):
$$\boxed{\;\mathbb E\Big[\lVert\hat w_{\text{ML}}-w\rVert^2\Big]=\sigma^2\;\operatorname{tr}\!\Big(\big(XX^\top\big)^{-1}\Big)\;}$$(use the pseudo-inverse if $XX^\top$ isn't invertible; for simplicity assume it is.) It is a product of two terms:
| Term | What it is | Effect |
|---|---|---|
| $\sigma^2$ | variance of the label noise | More noise, worse estimate. Makes sense: noise hides $w^\top x$. |
| $\operatorname{tr}\big((XX^\top)^{-1}\big)$ | depends only on the features; $XX^\top$ is like a covariance matrix | How the features relate to each other also decides the quality of the estimate. |
5 · What we can and can't control
$\sigma^2$ belongs to the data-generating process. The noise is added before the data reaches us, so we have to live with it. The features $X$, though, are in our hands. So if a better estimator (lower mean squared error) exists at all, it has to come from doing something about the $\operatorname{tr}\big((XX^\top)^{-1}\big)$ part. That's the question for L35.
Two features, true $w=(1,\,-0.5)$. The features are drawn once (fixed); each dot is $\hat w_{\text{ML}}$ from one of 400 datasets with fresh label noise. Correlation makes the two features nearly redundant.
Key takeaways
- The labels are random, so $\hat w_{\text{ML}}$ is random. Judge it on average over datasets, not on one.
- Goodness = mean squared error $\mathbb E\lVert\hat w_{\text{ML}}-w\rVert^2=\sigma^2\operatorname{tr}\big((XX^\top)^{-1}\big)$.
- Two factors: noise variance $\sigma^2$ (out of our control) and a feature term (possibly improvable).
- Any better estimator must attack the $\operatorname{tr}\big((XX^\top)^{-1}\big)$ term (L35).