View source: R/clustering_functions.R
cost_clusters_from_dissim_medoids | R Documentation |
Compute the cost and clusters based on an input dissimilarity matrix and medoids
cost_clusters_from_dissim_medoids(data, medoids)
data |
a dissimilarity matrix, where the main diagonal equals 0.0 and the number of rows equals the number of columns |
medoids |
a vector of output medoids of the 'Cluster_Medoids', 'Clara_Medoids' or any other 'partition around medoids' function |
a list object that includes the cost and the clusters
Lampros Mouselimis
data(dietary_survey_IBS)
dat = dietary_survey_IBS[, -ncol(dietary_survey_IBS)]
dat = center_scale(dat)
cm = Cluster_Medoids(dat, clusters = 3, distance_metric = 'euclidean', swap_phase = TRUE)
res = cost_clusters_from_dissim_medoids(data = cm$dissimilarity_matrix, medoids = cm$medoid_indices)
# cm$best_dissimilarity == res$cost
# table(cm$clusters, res$clusters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.