Mixture Models (EM Algorithm)
Context: FIT2086_MOC · W11 · the probabilistic fix for k-means Clustering’s weaknesses · each class carries its own distribution, often a Multivariate Normal Distribution · soft membership is Bayes’ Theorem · chosen by information criterion · fitted by weighted ML · the Pima fit is the joint-modelling classifier from Classification and Conditional Class Probabilities Parent Framework: Machine Learning Styles (Supervised vs Unsupervised)
Quick Revision
- 🎯 Objective: model the data as weighted sub-populations ➔ soft-assign each item by its posterior ➔ fit by EM for fixed , choose by information criterion.
- 📦 Core Components: mixing weights ➔ class prevalence | class models ➔ any family per attribute | EM ➔ E-step soft assign, M-step weighted ML | IC / MML ➔ picks .
- ⚡ Key Constraint: the posterior is weight × likelihood, normalised — ranking classes by alone ignores prevalence, and the unnormalised products give the class but not its probability.
📝 How It Works
1. The Model
- Mixture density ➔ · classes · mixing (population) weights · parameters of class ‘s joint distribution.
- Class = cluster ➔ is the fraction of the population in sub-population ; each class has its own distribution per attribute (normal, inverse Gaussian, Poisson, …).
- Simple form (conditional independence within class) ➔ ⟹ univariate models.
- Mixed attribute types ➔ each column takes its own family (Pima: predictors Gaussian, diabetes status Bernoulli) — the case k-means handles badly.
- Related attributes ➔ swap the product for a Multivariate Normal Distribution per class (height and weight correlate within a person).
2. Soft Membership
- Posterior by Bayes ➔ · = a priori probability of class · = probability of under class .
- Partial assignment ➔ each item belongs to every class with probability , ; a hard label, if wanted, is the highest posterior.
- as dissimilarity ➔ equal spherical Gaussians ⟹ comparing ≡ comparing Euclidean distance to centroids (k-means) · general Gaussian ⟹ Mahalanobis-type distance · Bernoulli, Poisson, … ⟹ their own model-appropriate measures.
3. Estimation by EM (fixed )
- Initialise ➔ random class memberships or random starting parameters.
- E-step ➔ soft-assign every individual: from the current parameters.
- M-step ➔ re-estimate every (, ) by weighted ML, item counting with weight toward class .
- Repeat until the estimates stabilise.
- Generalises k-means ➔ k-means is EM with 0/1 weights and spherical equal-variance Gaussians.
4. Choosing
- Score ➔ information criterion goodness of fit complexity penalty on classes/parameters ➔ smallest wins ➔ Model Selection and Information Criteria (AIC, BIC).
- MML ➔ minimum message length (C.S. Wallace, Monash): compress the data using the model; the model giving the shortest compressed data wins.
- Search ➔ non-convex, many local minima ⟹ each iteration: remove classes with too few points · try splitting every class · try combining pairs · randomly reassign and re-estimate ➔ refit with EM, score, keep the lowest, repeat.
5. Lecture Examples
- 1-D, two normals ➔ and — a bimodal density no single normal fits.
- 2-D ➔ discovered with — tiny classes survive if they buy enough fit.
- Galaxy velocities () ➔ : , , , .
- Pima diabetes ( people, diabetic; 12% of exposure cells missing, INS , SKIN ) ➔ criterion , , , ⟹ .
| Class | PREG | PLAS | BMI | AGE | DIA | |
|---|---|---|---|---|---|---|
- Reading ➔ high glucose drives both diabetic classes; class 2 is older with more pregnancies, class 1 younger and heavier · class 3 (young, low glucose, low BMI) is the low-risk profile.
- Slide inconsistency ➔ the summary infographic (slide 49b) prints class 1 as and calls class 2 the highest; the means table gives — table used here, confirm on the forum.
🔬 Model
- Data ➔ , row = item, column = attribute; no column is nominated as target (DIA in Pima is just another attribute).
- Parameters ➔ , ; ➔ free weights the per-class model parameters.
- Objective (fixed ) ➔ maximise the likelihood ⟺ minimise — log of a sum, so no closed form ⟹ EM.
- Objective over ➔ .
⚖️ Core Decision Matrix
| Method | Assignment | Similarity | Attribute types | Choosing | Statistical reading |
|---|---|---|---|---|---|
| k-means Clustering | hard, one cluster | squared Euclidean to centroid | continuous; mixed types awkward | outside the method (prior knowledge / trial) | none |
| Mixture model | soft, | , model-based | any family per column | inside: IC / MML score | explicit: prevalence , class distributions |
When It Flips: equal spherical Gaussians with hard 0/1 weights ⟹ the mixture is k-means; elongated or correlated clusters, mixed attribute types, overlapping classes, or a need for "how sure?" ⟹ mixture model.
📊 Exam Execution Trace & Applied Exercises
Manual Execution Trace
Lecture Q2: , , , .
| Step | Class 1 | Class 2 | Note |
|---|---|---|---|
| prior | class 2 more common | ||
| likelihood | data favour class 1 | ||
| product | sum | ||
| posterior | assign to class 1 — still for class 2 |
Applied Exercise
Problem: the 1-D lecture mixture (, ). Posterior class probabilities for .
Final Extracted Output: belongs to class 1 with probability — from but from , and class 1 is also more prevalent.
⚠️ Common Mistakes
- 💡 Dropping ➔ in the trace above, not — prevalence is half the answer.
- 💡 Reporting only the label ➔ the point of a mixture is the probability; “class 1 ()” earns what “class 1” does not.
- 💡 Choosing by likelihood ➔ more classes always fit better; only the penalised score can stop at .
🧠 Active Recall
Name three weaknesses of k-means and say how a mixture model removes each.
Answer
- Short answer: hard assignment ➔ soft ; mixed continuous/discrete attributes ➔ a separate family per column; no statistical interpretation or way to pick from the data ➔ an explicit likelihood scored by an information criterion.
- Why: Explicit probability model ➔ gives both the posterior (Bayes) and a fit term to penalise.
In what sense is EM a generalisation of k-means?
Answer
- Short answer: both alternate “assign” and “re-estimate”; k-means assigns hard to the nearest centroid and re-estimates means, EM assigns softly by posterior and re-estimates every parameter by weighted ML.
- Why: Spherical equal-variance Gaussians ➔ reduces to squared Euclidean distance (plus a constant), and forcing recovers k-means exactly.
The Pima criterion scores are and . Is clearly better than ?
Answer
- Short answer: no — a gap of is below the rule of thumb, so the two are comparable; is kept as the minimum and the simpler model, while () and () are clearly worse.
- Why: Score differences, not ranks ➔ see Model Selection and Information Criteria (AIC, BIC).
🔭 Beyond the lecture (not in the slides)
- Gaussian M-step in closed form ➔ · · — the ordinary MLEs with each item counted times.
- Monotone ➔ each EM iteration never increases , so it converges — but only to a local minimum, hence the restarts.