I want to apply kmeans clustering algorithm on dataset of 12008 samples. This dataset is actually an eigenvector matrix of size (12008 * 12008) generated from given laplacian matrix. In order to estimate the best value of k, I used a technique called Elbow method using R as the following:

k.max <- 10
wss <- sapply(1:k.max, function(k){kmeans(df1, k, nstart=3,iter.max=10 )$tot.withinss})
plot(1:k.max, wss,
     type="b", pch = 19, frame = FALSE, 
     ylab="within-clusters sum of squares")

The resulting plot looks like:

enter image description here

Clearly, there is no way to find out the possible k as the line is not curvey. Does anyone see why I am getting such a straight line instead of curve line?

  • 1
    $\begingroup$ Note the y axis. It's pretty much constant. But the root cause probably is the kind of matrix you input. K-means and the elbow method are meant to run on the original data. $\endgroup$ Apr 24, 2017 at 0:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.