powered by
Calculates the average silhouette coefficient from a silhouette object.
compute_silhouette(sil)
A numeric value indicating the average silhouette width, or NA if input is NULL.
NA
NULL
A silhouette object as returned by silhouette.
silhouette
data <- scale(iris[, 1:4]) cl <- kmeans(data, 3)$cluster sil <- cluster::silhouette(cl, dist(data)) if (interactive()) { compute_silhouette(sil) }
Run the code above in your browser using DataLab