MIT 6.790 — Lecture 2
ERM and MLE
Let's still assume all data is drawn (i.i.d.) from some fixed distribution , but say we don't know what is.
Remark. This isn't entirely realistic—sensor data, say, might have temporal correlations.
§ Empirical Risk Minimization
Here's a very simple idea: Use our training data to derive an empirical distribution like so:
Here, is the Dirac delta function, defined so that and for all .
Using the empirical distribution also gives us an empirical risk that looks like:
And so we might choose according to Empirical Risk Minimization (ERM), like so:
where is some class of candidate decision rules.
§ Overfitting
Of course, this stupid solution fails in stupid ways.
Example. Given a training set of spam / not-spam emails, decide whether future emails are spam.
ERM Solution. An email is declared spam if its timestamp matches that of a spam email in the training set.
This is an example of overfitting. Here are two approaches by which we might fix it:
Restrict the hypothesis class .
Approximate differently.
Let's take the latter of the two approaches for now: how can we better estimate ?
§ Maximum Likelihood Estimation
Remark. This section is written with the assumption of 18.650, particularly up through Lecture 9, which covers the MLE.
Rather than naively approximating using the empirical distribution , let's suppose belongs to a parametric model and estimate the parameter of via the MLE.
Example. (Bernoulli MLE) Suppose, for simplicity, that we only care about approximating the distribution of labels and ignore the features . Also assume that the are sampled from for some .
As a function of the samples , determine the MLE .
Solution: Because the labels are independent, the likelihood is:
We'd like to maximize the above, so it is natural to differentiate the above with respect to … but the result seems very messy. The trick, of course, is to consider the log-likelihood:
Technically we should treat separately. That aside, we can now differentiate easily.
The above equals exactly at . It now remains to check that this critical point is a maximum:
So the MLE must be .
§ MLE Advantages and Disadvantages
The MLE has some advantages!
Computation. As long as the likelihood is differentiable, it is often very easy and fast to computationally find the MLE.
Reparametrization. The MLE is invariant to reparametrization by a bijective function . (So nothing unexpected changes if we use, say, as a parameter instead of .)
But it also has some disadvantages.
No Indication of Certainty. An MLE computed using ten datapoints looks the same as an MLE computed using ten million.
Poor Performance for Small . If we sample from , it's likely the MLE will be stuck at for a while…
Likelihood Inflation. Consider a mixture model of two Gaussians and with mixture weight . The MLE has the freedom to decide the values of however it wants… so what if it does this?
MLE Proposal. Estimate and . Don't even bother with and .
With this proposal, the likelihood looks like this:
For choices of sufficiently small, the MLE can have as big a likelihood as it wants! But even though it's maximizing the likelihood, picking an estimator by only looking at a single sample does not seem very helpful…