Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome to your next lesson on the theoretical foundations of AI.
In our last lesson, we established the criteria for evaluating statistical estimators: unbiasedness, consistency, and efficiency. We now know what makes a "good" estimator, but we haven't yet discussed a general method for finding them. This lesson addresses that very question.
Your learning outcome today is to formulate the principle of Maximum Likelihood Estimation (MLE). MLE is arguably the most important and widely used method for parameter estimation in statistics and machine learning. We will define its core components, understand its mathematical formulation, and, to satisfy your preference for rigor, explore its deep connection to information theory.
1. The Core Principle: What Parameters Make My Data Most Probable?
Imagine you have a set of observed data points. You assume these points were generated by a probability distribution from a certain family (e.g., Gaussian, Bernoulli), but you don't know the specific parameters of that distribution (e.g., the mean and variance , or the probability of success ).
The central idea of Maximum Likelihood Estimation is simple yet powerful: Let's choose the parameter values that make our observed data the most probable, or "most likely," to have occurred.
To formalize this, we need to define a function that quantifies this "likelihood." The following video provides an excellent introduction to this concept, explaining how we construct the likelihood function from our data and why we want to maximize it.
Maximum Likelihood Estimation (MLE) with Examples
This video by Steve Brunton introduces the core concepts of MLE, explaining how the problem of parameter estimation is framed as an optimization problem.
Please watch from the beginning until 08:30. This segment covers: The initial setup of an estimation problem. The crucial role of the i.i.d. (independent and identically distributed) assumption in constructing the joint probability distribution. The formal definition of the likelihood function as a function of the parameters, given the data.
From Probability to Likelihood
As the video explained, the key is to shift our perspective. Let's make this concrete.
Suppose we have a set of i.i.d. data points , drawn from a distribution with a probability density/mass function , where is the unknown parameter we want to estimate.
-
The joint probability of observing this specific dataset is, due to independence, the product of the individual probabilities:
-
The likelihood function, denoted , is mathematically identical to this joint probability function. However, the interpretation is reversed. We treat the data as fixed and view this expression as a function of the parameter .
The principle of maximum likelihood estimation states that our best estimate for is the value that maximizes this function. We call this the Maximum Likelihood Estimate (MLE), denoted .

2. A Practical Improvement: The Log-Likelihood
Maximizing the likelihood function directly can be challenging. It's a product of many terms, which can be numerically unstable (leading to underflow if probabilities are small) and difficult to differentiate.
Fortunately, there is a simple and elegant solution: we can maximize the natural logarithm of the likelihood instead. This is valid because the logarithm is a monotonically increasing function. This means that if , then . The value of that maximizes the likelihood is the same value that maximizes the log-likelihood.
Let's continue with the same video to see this explained.
Maximum Likelihood Estimation (MLE) with Examples
This next segment of the video explains the motivation and mathematical convenience of using the log-likelihood function.
Please watch from 08:30 to 11:34. Focus on how the logarithm transforms the product in the likelihood function into a sum.
As the video demonstrated, the log-likelihood function, denoted or , is:
This transformation from a product to a sum makes finding the maximum much easier, as sums are far simpler to differentiate than products. The MLE is therefore found by solving:
In practice, for differentiable functions, this is usually done by taking the derivative of the log-likelihood with respect to , setting it to zero, and solving for . This connects directly to the optimization theory we covered in Module 4.

Test your understanding!
Suppose you have a single data point, , which you believe comes from a Poisson distribution. The Probability Mass Function (PMF) for a Poisson distribution is , where is the rate parameter you want to estimate.
Write down the likelihood function and the log-likelihood function .
Show answer
The likelihood function is simply the PMF evaluated at the observed data point , treated as a function of the parameter :
The log-likelihood function is the natural logarithm of the likelihood:
Notice how much simpler it would be to take the derivative of with respect to compared to .
3. The Theoretical Justification: Minimizing KL Divergence
So far, the principle of MLE seems intuitive. But is it theoretically sound? The answer is a resounding yes, and its justification lies in information theory, specifically in the concept of Kullback-Leibler (KL) Divergence.
KL Divergence, , measures how one probability distribution differs from a second, reference probability distribution . A key property is that , and if and only if and are identical.
In our estimation problem, there is a "true" but unknown data-generating distribution, let's call it . We are trying to find the best approximation for it from our family of model distributions, . Our goal is to find the that makes our model distribution "closest" to the true distribution . KL Divergence gives us a way to measure this closeness.
The following text provides a rigorous derivation showing that minimizing the KL divergence between the true distribution and our model is equivalent to maximizing the likelihood.
This article from AnalyticsVidhya provides a deep dive into the theoretical underpinnings of MLE, deriving it from first principles of information theory.
Please read the sections 'Kullback-Leibler Divergence' and 'Deriving the Estimator fo Maximum Likelihood Estimation'. Focus on understanding these key steps: How KL Divergence is defined as an expectation. How minimizing the KL divergence with respect to our parameter heta is structured. How the Law of Large Numbers is used to approximate the expectation with a sample average. How this leads directly to maximizing the log-likelihood function.
Let's walk through the logic from the article. Our goal is to find the that minimizes .
-
Decompose the KL Divergence: The definition of KL divergence is an expectation taken with respect to the true distribution :
We can split the logarithm:
The first term, , is the negative entropy of the true distribution. It does not depend on our parameter , so it's a constant with respect to our minimization problem. Therefore, minimizing the KL divergence is equivalent to minimizing the second term, or equivalently, maximizing its positive: -
Approximate the Expectation: We cannot calculate this expectation directly because we don't know the true distribution . However, we have a sample drawn from it! By the Law of Large Numbers (which we studied in Module 7), we know that the sample mean converges to the true expectation. We can therefore use our sample to approximate the expectation:
-
The Final Step: Substituting this approximation back into our maximization problem, we get:
Since the term is a positive constant, it doesn't change the location of the maximum. This leaves us with:
This is precisely the log-likelihood function we derived earlier from intuition. This rigorous connection demonstrates that MLE is not just a heuristic; it is a principled method for finding the model that best approximates the true data-generating process in an information-theoretic sense.
Conclusion
In this lesson, we have formulated the principle of Maximum Likelihood Estimation, a cornerstone of modern statistics and machine learning.
Key Takeaways:
- Principle: MLE finds the parameter values that maximize the probability (likelihood) of observing the given data.
- Likelihood Function: For i.i.d. data, the likelihood is the product of the individual probabilities/densities of each data point, viewed as a function of .
- Log-Likelihood: In practice, we maximize the log-likelihood , which turns the product into a computationally convenient sum, without changing the location of the maximum.
- Theoretical Foundation: MLE is equivalent to finding the model distribution that is "closest" to the true, unknown data-generating distribution , where closeness is measured by the Kullback-Leibler Divergence.
Preview of the Next Lesson:
We now have the principle. In the next lesson, we will apply it. You will learn how to derive the MLE for the parameters of a Bernoulli distribution. This will be our first practical application, where we use calculus to take the derivative of the log-likelihood function, set it to zero, and solve for the parameter, arriving at a familiar and intuitive result.