Live data from Hacker News

Maximum likelihood estimation and loss functions

rish-01.github.io

11–20 of 33 posts

Re: Maximum likelihood estimation and loss functions

#11

Somehow I've never found an explanation for MLE that's intuitive and suitable for someone who didn't take graduate-level statistics already. I'm 100% on board with the introduction (MSE and cross-entropy make total intuitive sense; you can see how they penalize 'wrongness' to an increasing degree) but in the next paragraph we jump right to: >Let pmodel(x;θ) be a parametric family of distributions over a space of para…

Let's say I'm a huckster that plays a game with you where if I roll a single six sided die and it lands on 1 you lose but you win otherwise.

Let's say you have some guarantee that I'm using the same die each time and that each of the rolls are independent. We play the game ten times and 1 is rolled the first 9 out of 10 times, with a 5 being rolled on the 10th throw. Now, you know that there's a common loaded die that can be purchased that has a weight to skew the probabilities and you further know that the loaded die rolls a 1 80% of the time and the remaining 20% spread evenly to the other values (so 4% for every other value).

Given a choice between the loaded die and the fair die, which is more likely?

The first model, call it $\theta_0$ is the fair die. The second model, with the unfair die, call it $\theta_1$.

The probability of the first model ($\theta_0$) is:

$p( 1,1,1,1,1,1,1,1,1, 5 ; \theta_0) = \frac{1}{6}^9 \cdot \frac{1}{6}$

(approximately .00000008269085843959)

The probability of the second model ($\theta_1$) is:

$p( 1,1,1,1,1,1,1,1,1, 5 ; \theta_1) = (0.8)^9 \cdot 0.2 \cdot \frac{1}{5}$

(or .00536870912000000000)

So we write a computer program to iterate through all the "models" to see which is the more likely. In this case, the iteration goes through two models.

The models can be Gaussians, with model parameters the mean and variance, say, or some other distribution with other parameters to choose from.

For some conditions on models and their parameterization, we might even be able to use more intricate methods that use calculus, gradient descent, etc. to find the MLE.

The MLE formalism is trying to say "given the observation, which parameters fit the best". It gets more complicated because we have to talk about which distributions we're allowing (which "model") and how we parameterize them. In the above, the models are simple, just assigning different probabilities to each of the outcomes of the die rolls and we only have a choice of two parameterizations.

Re: Maximum likelihood estimation and loss functions

#13

Somehow I've never found an explanation for MLE that's intuitive and suitable for someone who didn't take graduate-level statistics already. I'm 100% on board with the introduction (MSE and cross-entropy make total intuitive sense; you can see how they penalize 'wrongness' to an increasing degree) but in the next paragraph we jump right to: >Let pmodel(x;θ) be a parametric family of distributions over a space of para…

“an explanation for MLE”

I used to get by on, “it’s the parameters that make the data most likely”, like it says on the name. I think that’s what you are after.

Then I took a stats class, and I know to say, “the MLE is minimum variance within the class of asymptotically unbiased estimators” … that is, “efficient” and “asymptotically consistent“ in the jargon. (Subject to caveats.)

Then I took a Bayesian stats class and learned to say, “it’s minimum risk under a (improper) uniform prior.”

I also recall there is a general result showing that any estimator which makes the score function zero has good properties with respect to average loss. So zero’ing the score by maximizing likelihood is a good strategy. (If someone could remind me of specifics, that would be great.)

But perhaps Gauss had it right when he exploited the (known, but yet un-named) central limit theorem and used how easy it is to maximize the quadratic that sits atop its “e”. (https://arxiv.org/pdf/0804.2996, page 3, top). It’s so easy we had to find a justification for using it?

Re: Maximum likelihood estimation and loss functions

#14
post #8

Somehow I've never found an explanation for MLE that's intuitive and suitable for someone who didn't take graduate-level statistics already. I'm 100% on board with the introduction (MSE and cross-entropy make total intuitive sense; you can see how they penalize 'wrongness' to an increasing degree) but in the next paragraph we jump right to: >Let pmodel(x;θ) be a parametric family of distributions over a space of para…

This notation doesn't require graduate-level statistics knowledge, it's more like stuff that would be covered in a first mathematical course on probability and statistics. It's totally practical to learn this stuff on your own from videos, books, and PDFs. First you need to get a solid conceptual grasp on probability distributions and their associated concepts like random variables, conditional probability, and joint…

> This notation doesn't require graduate-level statistics knowledge, it's more like stuff that would be covered in a first mathematical course on probability and statistics.

My courses definitely used different notation for the same semantics.

Re: Maximum likelihood estimation and loss functions

#15
post #8

Somehow I've never found an explanation for MLE that's intuitive and suitable for someone who didn't take graduate-level statistics already. I'm 100% on board with the introduction (MSE and cross-entropy make total intuitive sense; you can see how they penalize 'wrongness' to an increasing degree) but in the next paragraph we jump right to: >Let pmodel(x;θ) be a parametric family of distributions over a space of para…

This notation doesn't require graduate-level statistics knowledge, it's more like stuff that would be covered in a first mathematical course on probability and statistics. It's totally practical to learn this stuff on your own from videos, books, and PDFs. First you need to get a solid conceptual grasp on probability distributions and their associated concepts like random variables, conditional probability, and joint…

> This notation doesn't require graduate-level statistics knowledge, it's more like stuff that would be covered in a first mathematical course on probability and statistics.

Perhaps a first course at grad level, but my engineering bachelors covered MLEs but we didn’t learn/use any of those formal language things. I think the core mathematics (and likely other pure science) cohorts were the only people who learnt it.

Re: Maximum likelihood estimation and loss functions

#16
post #8

Earlier quoted context omitted.

This notation doesn't require graduate-level statistics knowledge, it's more like stuff that would be covered in a first mathematical course on probability and statistics. It's totally practical to learn this stuff on your own from videos, books, and PDFs. First you need to get a solid conceptual grasp on probability distributions and their associated concepts like random variables, conditional probability, and joint…

> This notation doesn't require graduate-level statistics knowledge, it's more like stuff that would be covered in a first mathematical course on probability and statistics. Perhaps a first course at grad level, but my engineering bachelors covered MLEs but we didn’t learn/use any of those formal language things. I think the core mathematics (and likely other pure science) cohorts were the only people who learnt it.

I slowly transfered out of Trad. Engineering (Civil/Mech/Electrical/Electronic) pretty much because Engineering Math, Chem, and Physics units were almost all "learn these results and how to apply them" and little to no "these are the underpinings of these results".

It took six months for Math 100 (Maths for wanna be mathematicians) to "catch up" with the applications being spat out in Math 101 (Maths for people that practically use math for applications) but by the time the foundations were laid almost all the applied math in the Engineering coursework results just became "an exercise for the reader" to derive without need for rote memorisation.

Re: Maximum likelihood estimation and loss functions

#17
If you have a parametrized functions that imperfectly models a real phenomenon, of course there are errors. Why assume they are random? A better assumption is that your model is just poor. Assuming deterministic modeling errors are due to randomness has always struck me as bizarre.

Re: Maximum likelihood estimation and loss functions

#18

Somehow I've never found an explanation for MLE that's intuitive and suitable for someone who didn't take graduate-level statistics already. I'm 100% on board with the introduction (MSE and cross-entropy make total intuitive sense; you can see how they penalize 'wrongness' to an increasing degree) but in the next paragraph we jump right to: >Let pmodel(x;θ) be a parametric family of distributions over a space of para…

Generally, when we construct models we do so by defining what probability they give to the data. That's a function that takes in your data set and returns some number, the higher the better.

Technically, these functions need to satisfy a bunch of properties, but those properties matter mostly for people doing the business of building and comparing models. If you just have a model someone already made for you, then "the higher the better" is good enough.

It's also the case that these models have "parameters". As a simple example, the model of a coin flip takes in "heads" or "tails" and returns a number. The higher that number, the more probable it claims that outcome to be. When we construct that model, we also choose the "fairness" parameter, usually setting it so that both heads and tails are equally likely.

So really, it's a function both of the data and of its parameters.

Now, "maximum likelihood estimation" (MLE) is just the method where you fix the data inputs to the model to whatever your training data is and then find the parameter inputs that maximize its output. This kind of inverts the normal mechanism where you pick the parameters and then see how probable the data was.

Presumptively, whatever parameterization of your model makes the data the most likely is the parameterization that best represents your data. That doesn't have to be true, and often is only approximately true, but that presumption is exactly what makes MLE popular.

Finally, it's worth describing the origin of the name. When we look at our model after fixing the data inputs and consider it a function of its parameters instead we call that function a "likelihood". This is just another name for "probability" except it's used to emphasize that likelihoods don't meet all the technical properties I skipped up above. So "maximum likelihood estimation" is just the process of estimating the parameters of your model by maximizing the likelihood.

Re: Maximum likelihood estimation and loss functions

#19
My favorite MLE example: Suppose you walk into a bank and ask them to give you a quarter. You flip the quarter twice and get two heads. Given this experiment, what do you estimate to be the probability p of getting a heads when you flip this coin? Using MLE, you would get p = 1. In other words, this coin will always give you a heads when you flip it! (According to MLE.)

Re: Maximum likelihood estimation and loss functions

#20

Somehow I've never found an explanation for MLE that's intuitive and suitable for someone who didn't take graduate-level statistics already. I'm 100% on board with the introduction (MSE and cross-entropy make total intuitive sense; you can see how they penalize 'wrongness' to an increasing degree) but in the next paragraph we jump right to: >Let pmodel(x;θ) be a parametric family of distributions over a space of para…

I was doing machine learning but never dig into stats before. Then I tried to study Bayesian inference and regression by myself and finally I got what it really means and its importance. First I realised that ubiquity of 'likelihood' and 'likelihood function', then I realised it's just a way to parameterise the model parameters instead of input data. Then MLE is a way to get an estimate of maximum of that function, which is interpreted as the most likely setting to give rise to the data observed.

I know it's not statistically correct but I think it helped a lot in my understanding of other methods....

Post reply on HN