Advanced Mathematics

Maximum Likelihood

Estimating a model's parameters by choosing the values that make the observed data most probable.

Needs a step first: 18

Given data x1,…,xnx_1,\dots,x_n and a model with parameter θ\theta, the likelihood L(θ)=∏if(xi∣θ)L(\theta)=\prod_i f(x_i\mid\theta) says how probable the data are for each θ\theta. Maximising it, usually through the log-likelihood ∑ilog⁡f(xi∣θ)\sum_i\log f(x_i\mid\theta) so that products become sums, gives the estimate. For a normal model it gives the sample mean, and fitting by squared error is maximum likelihood under normal noise. Minimising cross-entropy when training a classifier or a language model is maximum likelihood too.

Where it shows up: A language model is trained by maximum likelihood: its loss is minus the log of the probability it gave to each actual next word.

How to hold it: In your head

See maximum likelihood as choosing the parameters that make the data least surprising, and see why the log turns the product into a sum and why squared error is a normal likelihood in disguise.

What knowing it looks like

  • Write the log-likelihood of a sample under a given model and maximise it by differentiating.
  • Check that the stationary point found is a maximum.
  • Explain why minimising squared error and maximising a normal likelihood give the same fit.

Test yourself

Waiting times of 22, 33 and 55 minutes are observed, assumed independent and exponential with density λe−λt\lambda e^{-\lambda t} for t≥0t\ge0. Find the maximum-likelihood estimate of λ\lambda.
Show the worked answer
L(λ)=λe−2λ⋅λe−3λ⋅λe−5λ=λ3e−10λL(\lambda)=\lambda e^{-2\lambda}\cdot\lambda e^{-3\lambda}\cdot\lambda e^{-5\lambda}=\lambda^3e^{-10\lambda}, so ℓ(λ)=3ln⁡λ−10λ\ell(\lambda)=3\ln\lambda-10\lambda. Setting ℓ′(λ)=3λ−10=0\ell'(\lambda)=\tfrac3\lambda-10=0 gives λ^=0.3\hat\lambda=0.3 per minute, and ℓ′′(λ)=−3λ2<0\ell''(\lambda)=-\tfrac{3}{\lambda^2}<0, so it is a maximum. It equals 1/tˉ1/\bar t: the mean wait was 103\tfrac{10}{3} minutes.

Needs a step first: 18

Learn it with an AI

Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.

Be my maths tutor. I'm learning "Maximum Likelihood" (Undergraduate II tier): Estimating a model's parameters by choosing the values that make the observed data most probable.
I already know: Probability Densities, Rates of Change and Extremes.
Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away.
Finish by testing me with this: Waiting times of $2$, $3$ and $5$ minutes are observed, assumed independent and exponential with density $\lambda e^{-\lambda t}$ for $t\ge0$. Find the maximum-likelihood estimate of $\lambda$.
Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.

On the way to

Recommended