# K means clustering time fluctuates with increased value of K

I have written k means clustering code in c#. I am clustering random 99 text articles of Sports Area which I downloaded from Github for different values of K i.e.3,4,5,6,7. I want to analyze the time period taken for K means Clustering

Following is the time taken for different values of K

K = 3     Time taken = 2 and half hour
K = 4     Time taken = 3 hour 30 minute
K = 5     Time taken = 3 hour 50 minute
K = 6     Time taken = 3 hour 32 minute
K = 7     Time taken = 3 hour 35 minute


As you can see that time taken increases from K= 3 to K =5 and then decreases for K=6 and increases again for K = 7.

My question : Is this result valid? As the value of K increases shouldn't time taken by K means algorithm also increase? Suggestions needed

• Did you check also the number of iterations taken before convergence in each case? Nov 24 '18 at 13:07
• It (the number of iterations needed to converge to a given threshold) is data-dependent and not clearly related to k. Moreover, if k is very large so it approaches the number of objects, less time will be needed. Nov 24 '18 at 16:09