[R] kmeans: "did not converge in 10 iterations"

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Mar 31 09:22:09 CEST 2006


Linda Lei wrote:

> Hi All,
> 
>  
> 
> I run function "kmeans" to cluster a matrix. But when the matrix size is
> big enough, it keeps saying "did not converge in 10 iterations". Could
> you explain what it means and if the result is wrong? 

What is the definition of "wrong" in cluster analysis?
The warning (not error!) says the algorithm did not converge, i.e. stuff 
could have been changed in subsequent (not allowed) iterations or it 
never converges (which we do not know using 10 iterations only).

So you should increase the number of max. allowed iterations in order to 
give the algorithm a chance to converge.


> And the interesting thing is sometimes this warning happens when the
> sample size is around 51200 x 6, sometimes it happens around 30000 x 6.
> Does the warning related to sample size or not?

Not only. You might want to read the help page and the references for 
the algorithm you are using.
If the starting set of centers is chosen well, convergence might happen 
in a few iterations even for a big matrix, otherwise you might need some 
more.

Uwe Ligges


>  
> 
> This also happens in "bclust".
> 
>  
> 
> Thank you!
> 
>  
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list