- Introduced by
- Multiple authors (Zhai et al., 2019; earlier formulations in semi-supervised GMM literature)
- Year
- 2010s–2019
- Type
- Probabilistic generative model with self-supervised pretraining
- Family
- Machine learning
What does it do?
SS-GMM is a two-stage pipeline: a neural encoder is first trained on a label-free pretext task, and a Gaussian mixture model is then fitted to the resulting embeddings.
It targets high-dimensional data, such as images, text embeddings, or omics profiles, where raw feature distances are weak proxies for similarity. "SS-GMM" is a descriptive label for this pipeline rather than a standardised, named algorithm.
The intuition behind the method
A classical GMM assumes the raw data points come from a blend of Gaussian clouds and uses EM to identify those clouds. On high-dimensional or structured data (images, gene expression profiles), raw pixel or feature distances often do not reflect semantic similarity, so GMM components fitted directly to them may be uninformative. The self-supervised step first trains a neural network on a pretext task that needs no labels, such as predicting image rotations, reconstructing masked tokens, or contrasting augmented views of the same input. This encourages the network to encode structure in the data. The GMM is then fitted in the learned space, where Gaussian shapes may or may not be a better fit than in the raw space; this must be verified on the data.
History
Gaussian mixture models are conventionally fitted with the expectation-maximisation (EM) algorithm. No single originator of the specific combination of a self-supervised encoder with a GMM is established, so the name is best read as a description of the pipeline. S4L (Zhai et al., 2019) is a semi-supervised image learning method built on self-supervised learning. Its title and scope do not concern Gaussian mixture models, so it is cited here as related work rather than as a source for the mixture formulation.
When to use it
Consider SS-GMM when you have a large pool of unlabeled high-dimensional samples (images, text embeddings, omics data), few or no labels, and an interest in probabilistic clustering with soft memberships and likelihood-based comparison of models. It may help where clustering on raw features gives poor results because distances in the raw space are dominated by irrelevant variation. Do not use it when labels are abundant (a supervised model is more appropriate), when the data are low-dimensional and tabular (a standard GMM is usually enough), when you need to interpret individual input features (the learned encoder obscures this), or when compute is tightly limited, since encoder pretraining is the costly step.
Limitations and considerations
- Pretraining a neural encoder is the dominant computational cost and must be completed before GMM fitting begins.
- The pretext task, encoder architecture, embedding dimension, and K all need choosing, and none is determined by the mixture model itself.
- EM can converge to local optima, so results vary with initialisation and multiple restarts are needed.
- Soft memberships can be misleading if the embedding clusters are not close to Gaussian in shape, because the responsibilities then reflect a poor model fit.
- Likelihood comparisons across different encoders or embedding dimensions are not valid, because the density is defined on different spaces.
- Full covariance matrices have many free parameters per component, and their number grows with the square of the embedding dimension, so they need many samples per component. When samples are limited, diagonal or spherical covariance, or a lower-dimensional embedding, are alternatives. The covariance type is a modelling choice and should be reported with the results.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Uses large unlabeled datasets without manual annotation, since the encoder is pretrained on a pretext task.
- Gives soft cluster memberships that can be used for downstream probabilistic reasoning. These are only as reliable as the Gaussian fit in the embedding space.
- BIC and AIC can compare different values of K, but only for models fitted to the same fixed embedding space.
- The encoder is trained on the data itself, so the embedding may capture the data's structure better than a fixed generic feature extractor. Whether the resulting clusters are close to Gaussian in shape must still be checked, for example by held-out likelihood or a raw-feature baseline.
- Extends to a semi-supervised setting by anchoring components with a few labeled examples.
Applications
- Unsupervised image clustering, where GMMs on raw pixels may fail but learned embeddings can group images by content.
- Exploratory clustering of high-dimensional omics profiles, such as single-cell gene expression data, where raw-feature distances may be uninformative.
- Anomaly detection by flagging points with low likelihood under the fitted mixture.
- Semi-supervised classification when only a few labeled examples are available per class.
- Document or sentence clustering using transformer embeddings as the representation space.
How it works
How it works
A neural encoder is trained on a pretext task that requires no manual labels. Common choices include predicting image rotations, solving jigsaw puzzles, masked autoencoding, and contrastive learning with augmented views. The pretext loss is meant to push the encoder toward structure in the data rather than superficial statistics.
After pretraining, the encoder maps each data point into a lower-dimensional embedding space. The mixture model is fitted in this space, so its Gaussian assumptions apply to the embeddings and not to the original features.
A K-component Gaussian Mixture Model is fitted to the embeddings. Each component k has a mixing weight pi_k, a mean vector mu_k, and a covariance matrix Sigma_k. The mixture density is p(x) = sum_k pi_k N(x | mu_k, Sigma_k). The number of components K is chosen by BIC, AIC, or domain knowledge.
Formula
p(x) = \sum_{k=1}^{K} \pi_k \mathcal{N}(x \mid \mu_k, \Sigma_k)The EM algorithm alternates E-steps, which compute soft responsibilities gamma_nk for each point-component pair, and M-steps, which update pi_k, mu_k, and Sigma_k to increase the expected log-likelihood. Iteration stops when the change in log-likelihood falls below a chosen threshold, and a local optimum may be reached.
Formula
\gamma_{nk} = \frac{\pi_k \mathcal{N}(x_n \mid \mu_k, \Sigma_k)}{\sum_j \pi_j \mathcal{N}(x_n \mid \mu_j, \Sigma_j)}Each point is assigned to the component with the highest responsibility (hard assignment), or its soft membership probabilities are kept for downstream use. If a small set of labeled examples is available, it can be used to anchor specific components, which turns the approach into a semi-supervised variant.
Common pitfalls
- Choosing K by visual inspection or arbitrarily, instead of by BIC, AIC, or likelihood on held-out data.
- Running EM once without restarts, which often yields a suboptimal local optimum.
- Pretraining the encoder on a small dataset, where it may overfit the pretext task and produce embeddings with little cluster structure.
- Treating the method as semi-supervised when labeled data are plentiful; a supervised model is then more appropriate.
- Reporting one clustering without checking whether the chosen K and the assignments are stable across EM initialisations and encoder training seeds.
Frequently asked questions
How is SS-GMM different from a standard GMM?
A standard GMM fits Gaussian components directly to raw features. SS-GMM first trains a neural encoder on a label-free pretext task to produce embeddings, then fits the GMM in that embedding space. Whether this gives better clusters depends on the data and on how well the pretext task captures the structure of interest, so it should be checked against a raw-feature baseline.
How do I choose the number of components K?
Use BIC or AIC, which penalise likelihood for model complexity, or likelihood on held-out data, all within one fixed embedding space. The silhouette score can serve as a supplementary check of cluster separation, but it does not replace likelihood-based criteria. Domain knowledge about the expected number of groups gives a useful starting range. Confirm that the chosen K gives assignments that agree across EM restarts and encoder seeds.
Can I use SS-GMM when I have some labels?
Yes. In the semi-supervised variant, labeled examples anchor or initialise specific mixture components, which guides EM toward solutions consistent with known class structure while still using the unlabeled data.
What pretext tasks work best for the self-supervised stage?
No single pretext task is best for every dataset. Contrastive methods and masked autoencoding are common options, and the choice depends on the data modality: contrastive augmentation is commonly used for images, and masking is commonly used for text and sequences. Compare candidates by how well the resulting clusters agree with a known structure on a validation subset.
How many labeled examples are needed for the semi-supervised variant?
No fixed minimum is established for this method. The labeled set should be large enough to anchor each component that matters, and its adequacy should be checked on held-out labeled data. The self-supervised stage does most of the work on unlabeled data, so the labels mainly resolve ambiguous assignments.
Related methods
Sources
Zhai, X., Oliver, A., Kolesnikov, A., & Beyer, L. (2019). S4L: Self-supervised semi-supervised learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 1476–1485.
Open publication referenceMixture model. Wikipedia.
Open publication reference