View source: R/model_extractors.R
| get_cluster_assignment | R Documentation |
Computes the maximum-a-posteriori cluster label for every observation
directly from model$inclusion.p, with no need to re-run prediction
or supply G/Z/Y again. Shaped exactly like
predict_lucid()'s own pred.x: a numeric vector for early, a
list by layer for parallel, and a list by stage (recursively shaped) for
serial. Labels run 1, ..., K, matching Eq 21 and the row names used
by summary().
get_cluster_assignment(model)
model |
A fitted |
A numeric vector (early), a named list by layer (parallel), or a named list by stage (serial, each element shaped like the above depending on that stage's own type).
idx <- 1:200
G <- sim_data$G[idx, ]
Z <- sim_data$Z[idx, ]
Y_normal <- sim_data$Y_normal[idx, ]
fit <- estimate_lucid(G = G, Z = Z, Y = Y_normal, lucid_model = "early",
family = "normal", K = 2,
max_itr = 10, max_tot.itr = 30)
table(get_cluster_assignment(fit))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.