TensorTau PathToAGI Classical Machine Learning Level 04

Level 04 · Classical Machine Learning · Chapter 049

Gaussian Mixture Models

Can a cluster model express uncertainty instead of forcing every point into exactly one group?

Where We Are

K-Means draws a hard line: a point belongs to cluster 0 or cluster 1. Real data is often ambiguous.

Gaussian Mixture Models (GMMs) replace hard membership with probabilities.

1. Imagine several invisible generators

Suppose exam scores come from two overlapping populations. We do not know which student came from which population, but imagine each population generates scores according to a Gaussian.

A mixture model says:

  1. choose component kk with probability πk\pi_k;
  2. sample xx from that component’s Gaussian.

The resulting density is

p(x)=∑k=1Kπk N(x∣μk,Σk).p(x)=\sum_{k=1}^{K}\pi_k\,\mathcal N(x\mid\mu_k,\Sigma_k).

The weights satisfy πk≥0\pi_k\ge0 and ∑kπk=1\sum_k\pi_k=1.

2. Soft membership

For a particular point we can ask

p(z=k∣x).p(z=k\mid x).

These are called responsibilities. A point near the overlap might have

cluster A: 0.65
cluster B: 0.35

K-Means cannot express that uncertainty.

3. Geometry improves too

A Gaussian has a covariance matrix Σ\Sigma. Therefore a GMM component can represent stretched and rotated elliptical clusters.

K-Means:        GMM:
   ○○○          //////
  ○ • ○        ///•///
   ○○○          //////
 spherical      elliptical

4. Likelihood is the objective

Given data x1,…,xNx_1,\dots,x_N, we want parameters that make the observed data likely:

log⁡p(X)=∑ilog⁡(∑kπkN(xi∣μk,Σk)).\log p(X)=\sum_i\log\left(\sum_k\pi_k\mathcal N(x_i\mid\mu_k,\Sigma_k)\right).

There is a difficulty: the logarithm surrounds a sum. We do not know the hidden component ziz_i that generated each point.

This is why the next chapter exists.

5. Connection to K-Means

K-Means can be viewed roughly as a limiting case where components are spherical with similar variance and assignments become almost completely certain. GMMs are therefore not an unrelated algorithm; they soften and generalize the clustering story.

6. Shape Check

For N data points, D features and K components:

X               [N,D]
means           [K,D]
covariances     [K,D,D]
responsibility  [N,K]

Each row of the responsibility matrix sums to 1.

Break It

Fit too many Gaussian components to too little data. A component may collapse around a point with tiny covariance, creating numerical trouble and overfitting. Regularization still matters in unsupervised learning.

What to Remember

  • A GMM models data as a weighted sum of Gaussian generators.
  • Membership is probabilistic, not hard.
  • Covariance lets clusters be elliptical.
  • Hidden component identities make direct maximum-likelihood optimization awkward.

Next → Expectation Maximization: how can we learn model parameters when the variable we need—the component identity—is hidden?

Six ways to work the chapter, climbing from explaining it in your own words to investigating it like a researcher. Reading is not enough — this is where the chapter lands.

1 — Explain it

Explain hard vs soft clustering using two overlapping groups of heights.

2 — Calculate it

Given priors [0.6,0.4] and likelihoods for one point [0.2,0.5], normalize prior × likelihood to obtain responsibilities.

3 — Predict it

What happens to responsibilities when two component means move closer together?

4 — Break it

Fit a GMM with too many components to a tiny dataset. Inspect component variances and likelihood.

5 — Build it

Compute 1-D Gaussian mixture densities and posterior responsibilities from scratch.

6 — Investigate it

Compare K-Means and GMM on spherical and elongated synthetic clusters. Explain results using each model’s geometric assumptions.