Extract Cluster Labels from a Fitted Model
Source:R/evaluation_wrappers.R
extract_cluster_labels.RdThis function extracts cluster assignment labels from a fitted MFA or MPCA model object. It searches through common field names used by different model implementations.
Value
An integer vector of cluster assignments (1 to K), or NA if cluster labels cannot be extracted.
Details
The function searches for cluster labels in the following fields (in order):
z: Standard field for MFA/MPCA modelscluster: Alternative namingclusters: Plural formclass: Classification resultz_hat: Estimated assignmentscl: Short formhard_cluster: Hard assignment from soft clusteringlabels: Generic label field
If the model has a resp (responsibility) matrix but no hard assignments,
the function computes hard assignments using MAP (maximum a posteriori).
Examples
if (FALSE) { # \dontrun{
fit <- mfa_em_fit(list_of_data, K = 3, r = 2)
pred_cluster <- extract_cluster_labels(fit)
} # }