ML0096 Maximum Likelihood Estimation

What is maximum likelihood estimation (MLE), and how does it connect to the cross-entropy loss used in modern neural network training?

Answer

Maximum likelihood estimation is a method for estimating the parameters of a statistical model by finding the parameter values that make the observed data most probable. Given a dataset and a parametric model, MLE chooses the parameters that maximize the likelihood function: the joint probability of the observed data under the model. Equivalently, we maximize the log-likelihood, which converts the product of probabilities into a sum of log-probabilities, making optimization tractable and numerically stable. MLE is the foundation of most modern ML training: an ICLR 2025 blog post explicitly derives the standard classification cross-entropy loss from the MLE principle, showing that minimizing cross-entropy is equivalent to maximizing the conditional log-likelihood of the training data under the model. For a simple coin flip example, if you observe 3 heads in 4 flips, the MLE of the heads probability is simply 3/4, the sample proportion.

(1) Likelihood vs Probability: probability is the chance of data given fixed parameters; likelihood is the same function viewed as a function of parameters with the data fixed, and MLE finds the parameters that maximize it.
(2) Log-Likelihood Trick: taking the log converts the product \prod P(x_i \mid \theta) into the sum \sum \log P(x_i \mid \theta), which is easier to differentiate, numerically stable, and decomposes additively over data points for stochastic gradient descent.
(3) Connection to Production ML: an ICLR 2025 blog derives cross-entropy loss as the negative log-likelihood under a categorical model, so training a classifier with cross-entropy is MLE; logistic regression is MLE under a Bernoulli model, and linear regression with squared error is MLE under a Gaussian noise model.

Top panel: the likelihood curve L(theta) = theta^3 (1-theta) over theta from 0 to 1, peaking at theta = 0.75 where a dashed line and diamond marker label the MLE; bottom panel: the log-likelihood 3 ln(theta) + ln(1-theta), peaking at the same 0.75

Figure 1: Coin flip MLE: with 3 heads in 4 flips, the likelihood L(\theta) = \theta^3(1-\theta) and log-likelihood 3\ln\theta + \ln(1-\theta) both peak at \hat{\theta} = 3/4 = 0.75, the sample proportion of heads.

The coin flip example makes the principle concrete. Suppose you flip a coin 4 times and observe 3 heads and 1 tail. The coin has an unknown probability \theta of heads. The likelihood of observing this data is L(\theta) = \theta^3 (1 - \theta)^1, and the log-likelihood is \ell(\theta) = 3 \ln \theta + \ln(1 - \theta). Taking the derivative and setting it to zero gives 3/\theta - 1/(1-\theta) = 0, which solves to \hat{\theta} = 3/4. This is the sample proportion, and it is the MLE because the likelihood is maximized there. The same principle scales to neural networks: the cross-entropy loss L = -\frac{1}{N}\sum_i \log q_\theta(y_i \mid x_i) is the negative average log-likelihood, and gradient descent on this loss is MLE for the network’s parameters. A 2024 arXiv paper established finite-sample guarantees for MLE in logistic regression, showing the sample complexity depends on both dimension and signal strength, with distinct regimes at different signal-to-noise ratios.

Mathematical Formulation:
\hat{\theta}_{\mathrm{MLE}} = \arg\max_{\theta}\; \prod_{i=1}^{N} P(x_i \mid \theta)
\ell(\theta) = \sum_{i=1}^{N} \log P(x_i \mid \theta)
\hat{\theta}_{\mathrm{MLE}} = \arg\max_{\theta}\; \ell(\theta)

Where:

  • \hat{\theta}_{\mathrm{MLE}} is the parameter value that maximizes the likelihood; P(x_i \mid \theta) is the probability of observation x_i under the model with parameters \theta.
  • \ell(\theta) is the log-likelihood, which converts the product into a sum for tractability; maximizing \ell is equivalent to maximizing the likelihood because log is monotonically increasing.
  • For the coin flip: \ell(\theta) = N_H \ln \theta + N_T \ln(1 - \theta), and setting d\ell/d\theta = 0 gives \hat{\theta} = N_H / (N_H + N_T), the sample proportion. For classification: \ell = \sum_i \log q_\theta(y_i \mid x_i), and minimizing -\ell/N is the cross-entropy loss.
ModelLikelihoodMLE SolutionEquivalent Loss
Bernoulli (coin)theta^NH (1-theta)^NTNH / (NH + NT)Binary cross-entropy
Gaussian (regression)prod N(yi | f(xi), sigma^2)Least squares solutionMean squared error
Categorical (classifier)prod q_theta(yi | xi)Gradient descent on -log qCross-entropy loss

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *