View source: R/remap_canonical2.R
remap_canonical2 | R Documentation |
Avoid label switching by re-mapping sampled mixture component labels at each iteration (Peng and Carvhalo 2016).
remap_canonical2(z)
z |
A length-n vector of discrete mixture component labels |
A length-n vector of mixture component labels re-mapped to a canonical sub-space
# parameters n <- 10 # number of observations K <- 3 # number of clusters (mixture components) pi <- rep(1/K,K) # cluster membership probability z <- sample(1:K, size = n, replace = TRUE, prob = pi) # cluster indicators z <- remap_canonical2(z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.