Guide To AI LogoGuide To AI
Unit 15

Probabilistic Models for Machine Learning

modeling data distributions, inference techniques, and generative learning frameworks

Core Concepts Covered

  • Maximum Likelihood Estimation (MLE) vs. Maximum A Posteriori (MAP)
  • Bayesian Networks, Graphical Models, and GMMs
  • Variational Inference and Latent Variables

1. From MLE to MAP (Bayesian Parameter Estimation)

In classical statistics, we use Maximum Likelihood Estimation (MLE) to find parameters θ\theta that maximize the likelihood of the observed data: P(Dθ)P(D | \theta). However, MLE is highly prone to severe overfitting when data is scarce.

The Coin-Flip Example: Suppose you find a coin on the street, flip it twice, and get heads twice. An MLE model calculates the probability of heads as exactly θMLE=1.0\theta_{\text{MLE}} = 1.0 (100%100\%). This is highly unrealistic—it claims the coin is mathematically impossible to land on tails!

We solve this using Maximum A Posteriori (MAP) estimation. MAP is a Bayesian framework that incorporates a Prior Distribution P(θ)P(\theta)—representing our prior beliefs about likely parameter values before observing data (e.g., 'most coins are generally fair and land on heads 50%\approx 50\% of the time'). Using Bayes' Theorem, the posterior probability of θ\theta given data DD is:

P(θD)=P(Dθ)P(θ)P(D)P(\theta | D) = \frac{P(D | \theta) P(\theta)}{P(D)}

To find the MAP estimate, we maximize the posterior. Since the evidence denominator P(D)P(D) is constant with respect to θ\theta, this is equivalent to:

θMAP=argmaxθP(Dθ)P(θ)\theta_{\text{MAP}} = \arg\max_{\theta} P(D | \theta) P(\theta)

Taking the natural log gives:

θMAP=argmaxθ[lnP(Dθ)+lnP(θ)]\theta_{\text{MAP}} = \arg\max_{\theta} [ \ln P(D | \theta) + \ln P(\theta) ]

This formula demonstrates beautifully that MAP acts as a regularized version of MLE. The data likelihood term lnP(Dθ)\ln P(D | \theta) pushes the parameters to fit the observed data, while the prior term lnP(θ)\ln P(\theta) acts as a mathematical penalty, preventing the parameters from taking extreme or unrealistic values based on our prior knowledge. In our coin-flip example, the prior pulls the final MAP estimate back down from a ridiculous 100%100\% to a highly realistic 53%53\%!

2. Bayesian Networks, Latent Variables, and Variational Inference (VI)

Representing high-dimensional joint probability distributions is computationally impossible because the number of parameters grows exponentially with the number of variables. To solve this, we use Bayesian Networks (Probabilistic Graphical Models).

A Bayesian Network is a directed acyclic graph (DAG) where nodes represent random variables, and edges represent conditional dependencies. By asserting conditional independencies (that a variable is independent of non-descendants given its parents), we can factorize the joint probability compactly into a product of local conditional distributions: P(x1,x2,...,xn)=i=1nP(xiParents(xi))P(x_1, x_2, ..., x_n) = \prod_{i=1}^n P(x_i | \text{Parents}(x_i))

In many real-world datasets, we have variables that are never directly observed in our data. These are called Latent (hidden) Variables (for instance, a user's hidden interest category, or a patient's hidden disease state). Modeling these requires specialized latent variable frameworks.

Variational Inference (VI): In complex Bayesian models, calculating the exact posterior probability P(zx)P(z|x) of latent variables given our observations is mathematically intractable because the denominator (evidence integration) requires integrating over all possible hidden states. Variational Inference solves this by framing inference as an Optimization Problem. We choose a family of simpler distributions q(z)q(z) (like independent Gaussians) and find the specific parameters that minimize the KL divergence from our approximation to the true posterior. Minimizing this divergence is mathematically achieved by maximizing the Evidence Lower Bound (ELBO).

3. Gaussian Mixture Models & Expectation-Maximization

A Gaussian Mixture Model (GMM) is a powerful probabilistic clustering model that assumes all data points are generated from a mixture of KK different Gaussian distributions with unknown parameters.

Because we do not observe which Gaussian generated which data point, the assignment is a latent variable. We cannot solve GMM parameters using standard analytical derivatives. Instead, we use the Expectation-Maximization (EM) Algorithm:

1. Initialization: Start with random guesses for the means, variances, and mixing weights of the KK Gaussians.

2. Expectation (E-step): Calculate the probability (responsibility) that each data point belongs to each of the KK Gaussians, based on our current parameter guesses: γik=P(Gaussian kxi,θ)\gamma_{ik} = P(\text{Gaussian } k | x_i, \theta)

3. Maximization (M-step): Update the Gaussian parameters (means, variances, and weights) to maximize the expected log-likelihood of the data, using the responsibilities calculated in the E-step as weights.

4. Convergence: Repeat the E and M steps until the parameters stabilize.

Interactive Practice Quiz

Test your understanding with instant feedback

QUESTION 01

What is the primary difference between Maximum Likelihood Estimation (MLE) and Maximum A Posteriori (MAP)?

QUESTION 02

In a Bayesian Network, how do we factorize the joint probability of variables P(x1,x2,...,xn)P(x_1, x_2, ..., x_n) compactly?

QUESTION 03

What is a 'Latent Variable' in probabilistic modeling?

QUESTION 04

Which of the following describes the objective of the 'Expectation' (E-step) inside the EM algorithm?

QUESTION 05

What is the role of the 'Maximization' (M-step) inside the EM algorithm?

QUESTION 06

In complex Bayesian models, why is calculating the exact posterior probability P(zx)P(z|x) of latent variables mathematically 'intractable'?

QUESTION 07

How does Variational Inference (VI) solve the problem of intractable posterior estimations?

QUESTION 08

What is the 'Evidence Lower Bound' (ELBO) inside Variational Inference?

QUESTION 09

Which of the following describes the joint probability factorization of a Directed Acyclic Graph (DAG) Bayesian Network?

QUESTION 10

In a Gaussian Mixture Model (GMM), the 'Mixing Weights' represent: