This package implements fitting and conditional prediction for Gaussian Mixture Models (GMM). Given a matrix of data fit(::GMMFitMethod, X)
returns a fitted GMM as a Distributions.MixtureModel
. Given a fitted gmm, the method predict(gmm, x; input_indices=1:length(x), output_indices=length(x)+1:length(gmm))
returns a posterior GMM over the output dimensions conditioned on the observed vector x
at the input indices.
This package implements three GMMFitMethod
s.
-
EM: Standard Expectation Maximization for fitting Gaussian Mixture Models with full covariance matrices. Uses the GaussianMixtures.jl implementation with configurable initialization methods and covariance structures.
-
PCAEM: Fit a GMM in PCA-reduced space and transforms back to the original space, effectively learning low-rank covariance structures through dimensionality reduction.
-
FactorEM: Fit a mixture of factor analyzers [under construction]. Directly fit GMMs with covariance matrices constrained to the form
$Σ = FF' + D$ , where F is a low-rank factor matrix and D is diagonal, relying on an internal EM step for factor analysis. This method is particularly effective for high-dimensional data where the number of features exceeds the number of samples.
To perform fitting and prediction efficiently, PCAEM
and FactorEM
rely on an LRDMvNormal <: Distributions.AbstractMvNormal
class that this packages introduces to represent structured covariance matrices
See the examples
folder for example usage (note to ] dev ..
in the examples
environment to add StructuredGaussianMixtures
in development mode).
This package implements the Expectation-Maximization (EM) algorithm for fitting Gaussian Mixture Models (GMMs) under the assumption that covariance matrices are low-rank plus diagonal. This structure is useful as a form of regularization in high-dimensionsal settings. It is particularly useful in high-dimensional settings where the number of features is large compared to the number of data points. By constraining the covariance matrices in this manner, we achieve a balance between flexibility and computational efficiency while avoiding overfitting.
We consider a dataset represented as
with non-negative mixture weights
where:
-
$d_k \in \mathbb{R}^m$ is the diagonal vector capturing independent feature noise, -
$L_k \in \mathbb{R}^{m \times k}$ (with rank$k \ll m$ ) captures the dominant covariance structure via a low-rank factor.
The EM algorithm for fitting GMMs alternates between Expectation and Maximization:
- E-step: Compute responsibilities based on current parameters:
- M-step: Update parameters by maximizing expected complete-data log-likelihood.
Computing responsibilities requires inverting
This low-rank plus diagonal structure is particularly advantageous in settings such as time-series analysis (e.g. for finance), text modeling, gene expression analysis, and compressed sensing, where