
Calculate Within-Cluster Sum of Squares for Different k
Source:R/unsupervised-clustering.R
calc_wss.RdUsed for elbow method to determine optimal k
Value
A tibble with columns k (number of clusters) and
tot_withinss (total within-cluster sum of squares).
Examples
# \donttest{
wss <- calc_wss(iris[, 1:4], max_k = 6)
plot(wss$k, wss$tot_withinss, type = "b")
# }