Learn R Programming

daltoolbox (version 1.3.767)

cluster_gmm: Gaussian mixture model clustering (GMM)

Description

Model-based clustering using mclust::Mclust.

Usage

cluster_gmm(G = NULL, modelNames = NULL)

Value

returns a GMM clustering object.

Arguments

G

number of mixture components (clusters). If NULL, Mclust chooses.

modelNames

optional character vector of model names passed to Mclust.

Details

Fits a Gaussian mixture model and returns the MAP classification. The fitted model is stored in obj$model. Requires the mclust package.

The base clusterer() uses wcss as a generic default, but cluster_gmm() specializes that choice because GMM is a probabilistic model with an explicit likelihood function.

Default evaluation in cluster_gmm() is:

  • main metric: metric_loglik()

  • internal evaluation: loglik

  • external evaluation: entropy, purity, adjusted_rand_index

The general wcss fallback is not used as the main metric because it does not represent the fit criterion optimized by the mixture model.

References

Fraley, C., & Raftery, A. E. (2002). Model-based clustering. JASA. Banfield, J. D., & Raftery, A. E. (1993). Model-based Gaussian and non-Gaussian clustering.

Examples

Run this code
if (requireNamespace("mclust", quietly = TRUE)) {
 data(iris)
 model <- cluster_gmm(G = 3)
 model <- fit(model, iris[,1:4])
 clu <- cluster(model, iris[,1:4])
 table(clu)
}

Run the code above in your browser using DataLab