Returns a new gmm (or gmm_fit) with the components permuted into a
canonical order: weight descending, then ||mu|| descending as a
tiebreaker. The mixture distribution is unchanged — only the bookkeeping
order is — but the canonical ordering removes the EM label-switching
nuisance from snapshot tests, cross-run comparisons, and printed
summaries.
Value
A gmm (or gmm_fit) of the same subclass as g, with the
components permuted into canonical order.
Details
Applied automatically by the regime-specific fitters
(fit_moment_match(), fit_em_samples(), fit_kld_em()) and by the
top-level dispatcher fit_proxymix() when canonicalise = TRUE
(the default).
See also
Other ops:
dgmm(),
gmm_conditionalise(),
gmm_divergence(),
gmm_kld(),
gmm_marginalise(),
gmm_mean(),
gmm_modes(),
pgmm(),
rgmm()
Examples
g <- gmm(weights = c(0.1, 0.6, 0.3),
means = list(c(0, 0), c(3, 0), c(-1, 1)),
covariances = list(diag(2), diag(2), diag(2)))
gmm_canonicalise(g)
#> <gmm>: K = 3 components in p = 2 dimensions
#> [1] w = 0.6000, |mu| = 3.0000, tr(Sigma) = 2.0000
#> [2] w = 0.3000, |mu| = 1.4142, tr(Sigma) = 2.0000
#> [3] w = 0.1000, |mu| = 0.0000, tr(Sigma) = 2.0000