This is the flat 2D counterpart of the 3D Gaussian Mixture Model simulator: the same Expectation-Maximization algorithm, computed independently here in the page's own plane coordinates, but rendered natively in 2D — as a colour-banded density map (an isarithmic / contour view) instead of a 3D height field, with no camera or perspective involved at all.
p(x) = Σₖ wₖ · N(x | μₖ, Σₖ)
N(x|μ,Σ) = 1/(2π√|Σ|) · exp(-½ (x-μ)ᵀ Σ⁻¹ (x-μ))
E-step — with parameters fixed, compute how responsible each component is for each point:
rᵢₖ = wₖ N(xᵢ|μₖ,Σₖ) / Σⱼ wⱼ N(xᵢ|μⱼ,Σⱼ)
M-step — with responsibilities fixed, re-estimate every component from its weighted share of the data:
Nₖ = Σᵢ rᵢₖ
μₖ = (Σᵢ rᵢₖ xᵢ) / Nₖ
Σₖ = (Σᵢ rᵢₖ (xᵢ-μₖ)(xᵢ-μₖ)ᵀ) / Nₖ
wₖ = Nₖ / N
Each E/M pair can only raise (never lower) the data log-likelihood, so the algorithm climbs monotonically to a local optimum — watch Δ log-lik shrink toward zero. The colour bands are contour steps of equal mixture density, exactly like a topographic map read from directly above; the covariance ellipses are the 1σ boundary of each component's Gaussian, drawn from its eigen-decomposition.
- Components K — how many Gaussians the model is allowed to fit.
- Reinit means — restarts EM from a fresh random initialisation on the same data.
- New data — resamples the underlying dataset from new hidden Gaussian sources.