Gaussian Mixture Models
Learning Objectives
- Review the theory and implementation of Gaussian Mixture Models (GMM)
- Understand the application of GMMs in Geostatistics
- Demonstrate application of the GMM with practical examples
Introduction
Mixture models are common for statistical modeling of a wide variety of phenomena. The premise is that a continuous distribution could be approximated by a finite mixture of Gaussian or normal densities (McLachlan & Peel, 2000). These Gaussian mixture models (GMMs) are considered to be semi-parametric distribution models since they are neither defined by a single parametric form nor based entirely on the data. They are usually fit with the Expectation-Maximization (EM) algorithm (Dempster, Laird, & Rubin, 1977) that is computationally efficient. The number of components used in the GMM can vary while having a simple form to the probability density function (McLachlan & Peel, 2000).
GMMs can reproduce complex univariate or multivariate distributions of geoscience datasets (Hadavand & Deutsch, 2020) and are applied for different purposes including (1) fitting probability density functions to permit the extraction of conditional distributions, (2) imputation of missing data to facilitate the use of techniques that require a full valued data table (Silva & Deutsch, 2018), and (3) clustering data into groups that are internally consistent and externally different.
The fundamentals required to understand GMMs are reviewed. Then, the application of GMMs to geostatistical modeling problems are explored, followed by small practical examples.
Gaussian Mixture Model (GMM)
A GMM is a probability density function (PDF) represented as a weighted linear combination of Gaussian component densities. A GMM is represented as (Reynolds, 2009): where is a -dimension continuous-valued data vector, , are the mixture weights satisfying and , are the Gaussian components, denoted by their mean and covariance matrix . expresses the collection of all component parameters , containing the weights, means, and covariance matrix for all Gaussian components.
The interactive figure shows an example of fitting a GMM to a univariate distribution. The user decides an appropriate number of Gaussian components (from one to eight in this example). The number of components is a key choice and is discussed below.
Implementation Details
Implementation of GMMs requires (1) deciding the number of Gaussian components for fitting, and (2) applying a fitting algorithm (conventionally the EM algorithm) with the desired covariance matrix type. The data considered in fitting the GMM may have declustering weights assigned to them to account for preferential sampling. Setting the marginal distribution independently of the data distribution is another alternative in the presence of non-representative data.
Expectation-Maximization (EM) Algorithm
The EM algorithm is widely used for iterative computation of maximum likelihood estimates (MLE) of distributions (Ng, Krishnan, & McLachlan, 2012). The EM algorithm is used to determine the parameters (weights, means, and covariances) of the mixture model given some observed -dimensional data. This is achieved by maximizing likelihood, which determines the optimal parameters of the Gaussian components. The likelihood is the joint probability density of the observed independent data in terms of the statistical model parameters, as follows: An interior stationary point of the likelihood function is found by solving (McLachlan & Peel, 2000):
or in its more convenient logarithmic form:
The iterative EM algorithm used to calculate consists of the following four steps (Saxena et al., 2017):
| Step | Action |
|---|---|
| 1. | Initialize the parameters : Usually -means optimized centers are used as optimized starting locations for running the first EM iteration. |
| 2. | E-Step: Evaluate the conditional expectation for each Gaussian component given the current parameters at every data sample. |
| 3. | M-Step: Update the parameters for maximization of likelihood to match the observed values. |
| 4. | Check for convergence by comparing likelihood improvement of the initial parameters to the updated parameters from M-step, additional details can be found in (Silva & Deutsch, 2015). |
Steps 2 through 4 are repeated until the likelihood stabilizes, indicating convergence to a local optimum (Silva & Deutsch, 2015). The iteration limit and convergence tolerance are separate settings. Common defaults are a maximum of 100 iterations and a tolerance of on the improvement in average log-likelihood (Pedregosa et al., 2011).
Local Maxima
In the context of GMM fitting, the EM algorithm is sensitive to the initialization of the Gaussian parameters (Ng et al., 2012). A good practice that tends to avoid poor convergence is to use the optimized -means centroids as the means for starting the first E-step (Ng et al., 2012). Another common strategy is to consider several runs of the EM algorithm, where the initial parameters are randomly re-selected for each run; the optimum result of all random restarts is selected as the final set of parameters.
Covariance Matrix Type
The covariance matrix models the statistical relationships between variables within each component, that is, their spread, correlation and orientation. A covariance matrix needs to be positive definite and can be built in different forms: full, this is the most flexible type as each Gaussian component has its own matrix (refer to (McLachlan & Peel, 2000)); diagonal, there are unique variances (diagonal terms) for each Gaussian component, and all within-component correlations are zero; tied, the covariance matrix is shared between Gaussian components (Pedregosa et al., 2011). Although the choice of covariance type might depend on the amount of data available and the intended use of the GMM, using the full covariance type is recommended for the majority of applications since it provides the greatest flexibility.
Optimal Number of Components
There is a trade off between over- and under-fitting. A small number of components are preferred to avoid over-fitting. Several methods are available to help determine an appropriate number of components including the likelihood ratio test (LRT) and the Bayesian information criterion (BIC) (Hadavand & Deutsch, 2020; McLachlan & Rathnayake, 2014). These metrics help assess sensitivity to the number of Gaussian components for fitting a distribution; however, the final decision of the number of Gaussian components rests with the practitioner.
Likelihood Ratio Test (LRT)
There is a threshold where increasing the number of Gaussian components in a finite mixture does not significantly improve the likelihood estimate. Multiple GMMs are fit with an increasing number of components. The improvement in the fits are compared and the difference or ratio between them serves as a useful metric. The test for this hypothesis is the LRT (McLachlan & Rathnayake, 2014), defined as for some (usually ), where is the number of components and is the likelihood ratio. For appropriately low values of , is disregarded as the optimal number of components in favor of . A hypothesis test could be relative to , to serve as evidence against (McLachlan & Rathnayake, 2014): It is usually more convenient to work with log-likelihood to avoid numerical underflow from multiplying small densities. For mixture component tests, the usual chi-square calibration is not generally valid; a parametric bootstrap can be used (McLachlan & Rathnayake, 2014).
Bayesian Information Criterion (BIC)
A term is introduced to penalize a greater number of Gaussian components to avoid overfitting. The minimum score reflects the optimal number of components. Using more components results in a higher penalty: where is the number of free fitted parameters and is the number of data points (McLachlan & Peel, 2000). For components in dimensions with full covariance matrices, . The size of the dataset is also included in the penalty term although it is constant for any particular set of data.
Example Comparing BIC and LRT
An example follows which demonstrates the use of LRT and BIC. The two metrics are compared in the context of defining the optimal number of components for the univariate fit example.
BIC values for this dataset reach their minimum when the number of components is equal to two, increasing approximately linearly afterwards due to the penalty term, which is greater than the small likelihood improvement. The plotted LRT statistic compares components with at each horizontal-axis value . Its local minima indicate small improvements from an additional component; minimizing this statistic alone does not select the optimal number of components. Visual inspection of the fit in 2-D or 3-D may help determine the final number. A low number would often be preferred.
Applications in Geostatistics
Fitting Probability Distribution Functions (PDFs)
GMMs are useful for modeling complex, high dimensional data common in geoscience datasets (Sarkar, Melnykov, & Zheng, 2020). Generating smooth semiparametric models that fit the available data is an essential function of GMMs. The GMM modeled PDF can replace the original distribution for use in several geostatistical workflows. Consider the following bivariate distribution fit by a GMM with two components. Each component is parameterized by its mean, weights, and covariances, which combined produce the final mixture model. A GMM will show evidence of elliptical shapes (visible on the plot) that correspond to the constituent Gaussian components.
The Trend Modeling and Modeling with a Trend lesson offers one great example of GMMs primary application routes to modelling probability distributions. As explained by Harding & Deutsch (2021), GMM allow the bivariate relationship to be reproduced besides eliminating chances of binning artifacts in the Trend modelling work-flow.
Multiple Imputation
Multiple Imputation (MI) (Barnett & Deutsch, 2015; Enders, 2010; Little & Rubin, 2002) addresses an important and common geomodeling problem. Data sets are often missing measurements of some variables at some sample locations. Many geostatistical modeling workflows do not allow missing variables. MI is used to ‘fill in’ the values of variables missing at sample locations while honoring multivariate and spatial data distributions (Deutsch, Palmer, Deutsch, Szymanski, & Etsell, 2016).
Applications where this is important include principal component analysis (PCA), stepwise conditional transforms (SCT), minimum/maximum autocorrelation factors (MAF) and projection-pursuit multiple transformation (PPMT) (Silva & Deutsch, 2018).
GMMs have been integrated in MI by Silva & Deutsch (2018) to build the conditional distributions from which to draw the imputed samples. This improves the accuracy of the imputed values and reduces the computational expense of alternatives such as kernel density estimation (Barnett & Deutsch, 2015; Silva & Deutsch, 2018).
Clustering
Clustering is a class of unsupervised machine learning techniques for grouping objects based on their similarities. Common techniques include hierarchical, partitioning, model-based and probability density-based methods (Saxena et al., 2017). GMMs can be used as a probabilistic model-based method for clustering. The Gaussian components are fit to the available data and discrete classes (clusters) are assigned based on the maximum posterior probability of points belonging to each component (Martin, 2019; Sarkar et al., 2020; Saxena et al., 2017; Zhang, 2021).
A porphyry gold-copper deposit is used to demonstrate the use of GMMs for clustering geological data sets. The 3-D map and the bivariate relationships are shown below. The optimal number of clusters for this dataset is also tested using the BIC and LRT metrics, which can be seen in the following interactive figure. It displays the location of the varying assigned clusters as the number of components change. GMM clustering considers the anisotropy in the data through the covariances; -means clustering uses Euclidean distances and does not model within-cluster covariances. The GMM’s clusters strong anisotropies are visible in interactive figure below, especially for a higher number of components, say between 6 and 8.
BIC is minimized using three Gaussian kernels. In this interactive figure the LRT statistic at compares with components. Small values, such as those at five and eight components, indicate small likelihood improvements; their significance requires a calibrated test.
Discussion
Gaussian Mixture Models (GMMs) play a role in fitting a distribution of n-dimensional data. There are some limitations. As explored by Zhang (2021), GMM clustering is sensitive to data transformation, spikes (recurrent values), below detection limit (BDL) samples, and outliers. A GMM may include overlapping components that provide a reasonable fit to the distribution, but may not be appropriate for clustering. GMMs are a widely used Machine Learning method, are easy to employ, and are accessible in many different software packages.
References
Cite this lesson as:
Gomes, C. C., Boisvert, J., & Deutsch, C. V. (2022). Gaussian Mixture Models. In J. L. Deutsch (Ed.), Geostatistics Lessons. Retrieved from https://geostatisticslessons.com/lessons/gmm

