Machine LearningStatistics & Probability

What is the difference between likelihood and probability?

Question 279 of 303 · Updated

On this page

Probability describes how likely an outcome is when a model and its parameters are specified. Likelihood evaluates how well different parameter values explain data that have already been observed. They use the same probability expression, but answer different questions because different quantities are held fixed.

1. The central distinction#

Suppose a coin has an unknown probability of heads, denoted by θ.

  • Probability: Fix θ, then ask how likely different observations are. If θ = 0.7, what is the probability of getting 8 heads in 10 tosses?
  • Likelihood: Fix the observed data, then ask which values of θ best explain them. If 7 heads were observed in 10 tosses, compare θ = 0.5, 0.7, 0.8, and so on.

The probability model is written as P(data | θ). With θ fixed, it is a probability distribution over possible data. With the observed data fixed, the same expression viewed as a function of θ is the likelihood:

L(θ | data) = P(observed data | θ)

For continuous observations, the expression uses a probability density rather than the probability of one exact value.

Remember: Probability fixes the parameter and varies possible data. Likelihood fixes the observed data and varies candidate parameters.

2. A numerical coin-toss example#

Imagine tossing a coin 10 times and observing 7 heads and 3 tails.

Let θ be the probability of heads. Assuming independent tosses, the likelihood of the particular ordered sequence is:

LaTeX

If we consider the count of 7 heads without caring about order, the binomial probability includes the number of possible sequences:

LaTeX

The binomial coefficient is constant with respect to θ, so it does not change the maximizing value.

Compare candidate parameters:

Among these candidates, θ = 0.7 gives the largest likelihood. The maximum-likelihood estimate is:

θ̂ = heads / tosses = 7 / 10 = 0.7

The likelihood value 0.0022236 is not “the 0.222% probability that θ equals 0.7.” It is the likelihood function's value at that parameter for the observed sequence.

3. Why the same formula has two interpretations#

For a fixed parameter, P(X = x | θ = 0.7) describes probabilities for all possible values of X. Those probabilities sum to one.

For fixed observed data x = 7, the likelihood is:

LaTeX

This function is evaluated across candidate θ values. It is not generally a probability distribution over θ; it does not have to sum or integrate to one over the parameter space.

A quick mental model:

  • Probability: parameter fixed, possible data vary.
  • Likelihood: observed data fixed, candidate parameters vary.

4. A second example: estimating a conversion rate#

An online store observes 20 purchases from 100 visitors. Model each visitor's purchase as a Bernoulli trial with conversion probability p.

The likelihood, ignoring the binomial coefficient, is:

LaTeX

The maximum-likelihood estimate is:

p̂ = 20 / 100 = 0.20

If the conversion probability were fixed at 0.20, probability theory would describe possible purchase counts across repeated groups of 100 visitors. Once 20 purchases are observed, likelihood compares how well candidate conversion rates explain those observations.

This estimate does not prove the true conversion rate is exactly 20%. Sampling uncertainty remains.

5. How likelihood leads to maximum likelihood estimation#

Maximum likelihood estimation (MLE) chooses the parameter value that maximizes the likelihood of observed data under a specified model:

θ̂_MLE = arg max_θ L(θ | x)

For independent observations x₁, …, xₙ with density or probability mass function f(xᵢ | θ):

L(θ | x₁, …, xₙ) = ∏ᵢ₌₁ⁿ f(xᵢ | θ)

The product follows from the independence assumption. If observations are dependent, the joint model must represent that dependence; multiplying marginal probabilities blindly is incorrect.

Example: normal-distribution mean#

Suppose independent observations follow a normal distribution with unknown mean μ and known variance σ²:

Xᵢ ~ Normal(μ, σ²)

Maximizing the likelihood with respect to μ gives:

LaTeX

For observations 4, 5, 6, 7, and 8:

μ̂ = (4 + 5 + 6 + 7 + 8) / 5 = 6

The sample mean is the MLE of μ under this model. MLE is not always simply the sample mean; the result depends on the assumed distribution.

6. Why log-likelihood is used#

Likelihoods for large datasets can become extremely small because many probabilities or densities are multiplied. Direct multiplication can cause numerical underflow.

Taking the natural logarithm converts products into sums:

ℓ(θ) = log L(θ)

For independent observations:

LaTeX

Since logarithm is strictly increasing:

arg max L(θ) = arg max log L(θ)

For the coin example:

ℓ(θ) = 7 log(θ) + 3 log(1 − θ)

Differentiate and set to zero:

dℓ/dθ = 7/θ − 3/(1 − θ) = 0

7(1 − θ) = 3θ 7 = 10θ θ̂ = 0.7

Log-likelihood is easier to optimize, improves numerical stability, and preserves the maximizing parameter.

7. Likelihood versus probability: common misconceptions#

“Likelihood is the probability that a parameter is true.” Not in ordinary frequentist likelihood analysis. Likelihood measures relative support for candidate parameter values from observed data. Bayesian inference combines likelihood with a prior and normalizes to obtain a posterior distribution.

“Likelihood values must sum to one.” No. A probability mass function over possible outcomes sums to one for a fixed parameter. A likelihood over parameter values does not generally do so.

“A larger likelihood always means a better model.” Not without qualification. Likelihoods can compare parameter values under the same observed data and compatible model specification. Comparing models with different parameter counts or likelihood formulations may require likelihood-ratio tests, AIC, BIC, or held-out evaluation. Raw likelihood values alone can mislead.

“Likelihood and probability are unrelated.” They are closely connected: likelihood is built from the probability mass or density expression, viewed as a function of parameters after observations are fixed.

8. Likelihood ratio#

For the same observed data, compare two candidate parameter values using:

LaTeX

If LR = 5, the data have five times the likelihood under θ₁ as under θ₂, using the same model and likelihood convention. This is a relative comparison—not a statement that θ₁ has an 5/6 probability of being true.

Likelihood ratios are used in likelihood-ratio tests. Their interpretation depends on the hypotheses, model assumptions, and applicable regularity conditions.

9. How likelihood appears in machine learning#

  • Logistic regression: Bernoulli likelihood models binary labels given predicted probabilities. Training commonly minimizes binary cross-entropy, the negative log-likelihood.
  • Naive Bayes: Class-conditional likelihoods are combined with class priors to calculate posterior class probabilities using Bayes' theorem.
  • Linear regression: Under a Gaussian noise model with constant variance, maximizing likelihood is equivalent to minimizing the sum of squared residuals, up to constants and scaling.
  • Language models: Autoregressive models assign conditional probabilities to observed next tokens. Summed token log-probabilities form a sequence log-likelihood; training typically minimizes its negative.
  • Density estimation: A model can be trained to assign high likelihood to observed samples, provided its density construction is valid.

Binary cross-entropy example#

For binary label y ∈ {0, 1} and predicted probability p:

Negative log-likelihood = −[y log(p) + (1 − y) log(1 − p)]

If y = 1 and p = 0.9:

Loss = −log(0.9) ≈ 0.105

If y = 1 and p = 0.1:

Loss = −log(0.1) ≈ 2.303

The model receives a much larger penalty for assigning low probability to the event that actually occurred. Averaging this loss over examples gives binary cross-entropy.

10. Likelihood, probability and Bayesian inference#

Bayes' theorem combines a likelihood with a prior:

P(θ | data) ∝ P(data | θ) P(θ)

  • P(data | θ): likelihood contribution from the observed data.
  • P(θ): prior distribution over parameters.
  • P(θ | data): posterior distribution after observing the data.

The posterior is a probability distribution over θ after normalization. It is not the likelihood alone.

For example, a Bayesian coin analysis may use a Beta prior for the unknown head probability. After observing heads and tails, the posterior is updated using the binomial likelihood. The posterior can answer questions such as the probability that the head rate exceeds 0.5, conditional on the prior and observed data.

11. Assumptions and practical cautions#

  • Model specification: The likelihood must represent the data-generating process reasonably well. A wrong distribution or omitted dependence can produce misleading estimates.
  • Independence: Product likelihoods require the relevant conditional-independence assumption. Time series, repeated measures, and clustered observations may need joint or hierarchical models.
  • Parameter constraints: Candidate values must be valid for the distribution; a Bernoulli probability must be between 0 and 1.
  • Identifiability: Different parameter values should not produce indistinguishable observable distributions if a parameter is to be uniquely estimated.
  • Boundary solutions: A maximum can occur at the edge of the parameter space. Numerical optimization must respect constraints.
  • Small samples: An MLE can be unstable or biased in finite samples. Uncertainty estimates and diagnostics still matter.
  • Outliers and misspecification: Likelihood can be sensitive to extreme observations, especially under a poorly chosen noise distribution.

Maximizing training likelihood does not guarantee generalization. Evaluate on held-out data and inspect calibration, residuals, and model assumptions as appropriate.

12. Practical selection guide#

  1. Specify the random variable and its probability model.
  2. Identify unknown parameters and their valid ranges.
  3. If parameters are fixed and you ask about possible outcomes, calculate a probability.
  4. If data are observed and you compare candidate parameter values, construct the likelihood.
  5. For parameter estimation, maximize likelihood or log-likelihood.
  6. Check independence and distributional assumptions.
  7. Quantify uncertainty; do not treat an MLE as certainty about the true parameter.
  8. If you need a probability distribution over unknown parameters, specify a Bayesian prior and compute a posterior.

13. Quick interview recap#

What is probability? How likely an outcome is under a specified model and fixed parameter values.

What is likelihood? How well candidate parameter values explain observed data, with the data held fixed.

What is the key mathematical difference? Both use the probability mass or density expression. Probability views it as a function of data; likelihood views it as a function of parameters.

Does likelihood sum to one? No. It is not generally a probability distribution over parameters.

What is MLE? The parameter value that maximizes the likelihood of observed data.

Why use log-likelihood? It converts products into sums, improves numerical stability, and preserves the maximizer.

Is likelihood the same as posterior probability? No. Bayesian posterior inference combines likelihood and prior, then normalizes.

Key takeaway#

Probability asks, “If these parameters were true, how likely would these data be?” Likelihood asks, “Given the data we observed, which parameter values explain them best?” This change in viewpoint is foundational to maximum likelihood estimation and many machine-learning loss functions.

Related questions

Explore other topics:Deep LearningMLOps