Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- findWSS <- function(data) {
- print(paste("[TRACER] Finding WSS.."))
- start <- Sys.time()
- wss <- (nrow(data)-1)*sum(apply(data,2,var))
- for (i in 2:length(unique(data))) {
- wss[i] <- sum(kmeans(data, centers=i)$withinss)
- }
- plot(1:length(unique(data)), wss, type="b", xlab="Number of Clusters", ylab="Within groups sum of squares")
- end <- Sys.time()
- print(paste("[TIMER] Finding WSS:", difftime(end, start), "secs"))
- }
Add Comment
Please, Sign In to add comment