Skip to contents

Gaussian mixture model fit via EM, log-space responsibilities (hmgmm)

Usage

morie_geron_gaussian_mixture(
  X,
  n_components = 2,
  seed = 0,
  max_iter = 100,
  tol = 1e-06,
  reg = 1e-06
)

Arguments

X

Data (m, d).

n_components

int (>=1, <=m).

seed

LCG seed.

max_iter, tol, reg

EM controls.

Value

List with weights, means, covariances, responsibilities, labels, log_likelihood, ll_history, n_iter, converged, monotone.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_gaussian_mixture(V)
#> $weights
#> [1] 0.2055403 0.7944597
#> 
#> $means
#>          [,1]
#> [1,] 1.481189
#> [2,] 5.281018
#> 
#> $covariances
#> , , 1
#> 
#>           [,1]
#> [1,] 0.2924747
#> [2,] 3.5648622
#> 
#> 
#> $responsibilities
#>              [,1]      [,2]
#> [1,] 8.882821e-01 0.1117179
#> [2,] 7.208737e-01 0.2791263
#> [3,] 3.514423e-02 0.9648558
#> [4,] 2.230582e-05 0.9999777
#> [5,] 5.931540e-10 1.0000000
#> [6,] 6.848730e-16 1.0000000
#> [7,] 3.433648e-23 1.0000000
#> [8,] 7.474887e-32 1.0000000
#> 
#> $labels
#> [1] 0 0 1 1 1 1 1 1
#> 
#> $log_likelihood
#> [1] -17.34942
#> 
#> $ll_history
#>  [1] -17.43169 -17.36600 -17.35428 -17.35138 -17.35048 -17.35011 -17.34991
#>  [8] -17.34978 -17.34968 -17.34961 -17.34955 -17.34951 -17.34949 -17.34947
#> [15] -17.34945 -17.34944 -17.34943 -17.34943 -17.34943 -17.34942 -17.34942
#> [22] -17.34942 -17.34942
#> 
#> $n_iter
#> [1] 23
#> 
#> $converged
#> [1] TRUE
#> 
#> $monotone
#> [1] TRUE
#> 
#> $n_components
#> [1] 2
#> 
#> $estimate
#> [1] -17.34942
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Gaussian mixture fitted by EM with log-space responsibilities"
#>