Created
December 23, 2015 18:46
-
-
Save tvladeck/3b68431c5d87fb1e6559 to your computer and use it in GitHub Desktop.
determining optimal # of clusters in k means
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydata <- d | |
wss <- (nrow(mydata)-1)*sum(apply(mydata,2,var)) | |
for (i in 2:15) wss[i] <- sum(kmeans(mydata, | |
centers=i)$withinss) | |
plot(1:15, wss, type="b", xlab="Number of Clusters", | |
ylab="Within groups sum of squares") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment