Learn R Programming

deepgmm (version 0.2.1)

model_selection: Function to compare different models

Description

Compares different models and return the best one selected according to criterion (BIC or AIC).

Usage

model_selection(y, layers, g, seeds = sample(.Machine$integer.max, 10),
                             it = 50, eps = 0.001, init = "kmeans",
                             init_est = "factanal", criterion = "BIC")

Value

A list containing an object of class "dgmm" containing fitted values and list of BIC and AIC values.

Arguments

y

A matrix or a data frame in which rows correspond to observations and columns to variables.

layers

The number of layers in the deep Gaussian mixture model. Admitted values are 1, 2 or 3.

g

The number of clusters.

seeds

Integer vector containing seeds to try.

it

Maximum number of EM iterations.

eps

The EM algorithm terminates the relative increment of the log-likelihod falls below this value.

init

Initial paritioning of the observations to determine initial parameter values. See Details.

init_est

To determine how the initial parameter values are computed. See Details.

criterion

Model selection criterion, either "AIC" of "BIC".

Details

Compares different models and return the best one selected according to criterion (BIC or AIC). One can use diffefrent number of seeds.

References

Viroli, C. and McLachlan, G.J. (2019). Deep Gaussian mixture models. Statistics and Computing 29, 43-51.

Examples

Run this code
# \donttest{

y <- scale(mtcars)

sel <- model_selection(y, layers = 2, g = 3, seeds = c(1, 2, 12334),
                      it = 250, eps = 0.001, init = "kmeans", criterion = "BIC")
sel

summary(sel)
# }

Run the code above in your browser using DataLab