Skip to content

GPCM Covariance Shapes

This demo takes a few seconds to load and runs entirely in your browser (NumPy and matplotlib via Pyodide; no tgmm or PyTorch is involved). It mirrors the covariance parameterisation of GaussianMixture(covariance_type=...) (API: tgmm.covariance.gpcm).

Each component's covariance is split into three factors,

\[\Sigma_k=\lambda_k\,D_k\,A_k\,D_k^{\top},\qquad \det A_k=1,\quad D_k^{\top}D_k=I,\]

a volume \(\lambda_k\) (size), a shape \(A_k=\operatorname{diag}(a_{k1},a_{k2})\) (elongation, \(a_{k1}/a_{k2}\) is the axis ratio) and an orientation \(D_k\) (rotation by \(\theta_k\)). For two components, choose for each factor whether the components share it (E, equal: component 2 copies component 1), let it V**ary (each has its own sliders) or, for shape and orientation, fix it to the **I**dentity (**I: a circle, or no rotation). The three letters give the model's mclust code.

Component 2's slider is ignored whenever its factor is E (it copies component 1), and both shape sliders are ignored for shape I (both orientation sliders for orientation I).

Things to try: with EII / VII both shapes are circles (identity), EEE shares everything (the same ellipse twice), and VVV frees all three factors. The parameter count is what bic/aic charge for the covariances, which is why constrained models win on small data (see the Covariance Structures tutorial).