Runs the supplied fitter from each of several initialisations and returns the fit with the best score, following Karlis and Xekalaki (2003)'s recommendation.
Value
The gmm_fit with the largest score_fn(fit).
See also
Other init:
init_kmeans(),
init_moment_seed(),
init_random(),
init_warm_start()
Examples
x <- matrix(stats::rnorm(200), ncol = 2)
tgt <- gmm_target_from_samples(x)
inits <- list(init_random(2L, 2L, seed = 1L),
init_moment_seed(x, N = 2L))
best <- multi_start_best_of(
fit_fn = function(init, ...) fit_em_samples(tgt, init = init, ...),
inits = inits,
score_fn = function(fit) fit@diagnostics$loglik_final,
max_iter = 25L
)
best@diagnostics$loglik_final
#> [1] -285.4343