R/find_elbow.R
avg_sil_score.Rd
avg_sil_score This function takes in a vector of cluster labels and a corresponding array of points and calculates the average silhouette score across all clusters. It returns the value of the average silhouette score.
avg_sil_score(labels, X)
labels | vector: A vector of cluster labels. |
---|---|
X | matrix: A (n_points x n_features) matrix of points. |
numeric: The average silhouette score.
helper_data <- array(c(c(0, 10, 10), c(0, 10, 11)), dim = c(3,2)) helper_clusters <- c(1, 2, 2) avg_sil_score(helper_clusters, helper_data)#> [1] 0.620674