[R] Help with K-means Clustering

Roberto Perdisci roberto.perdisci at gmail.com
Fri Nov 16 02:53:29 CET 2007


Hi,
 if you use the function kmean in the package stats, for example

clust <- kmeans(data, k, iter.max = 10)

where k is the number of desired cluster, kmeans will choose the first
k centers randomly. Because of this random initialization, after
iter.max iteration the solution may converge to different final
clusters (and therefore different centers and validity measures).

see   ?kmeans  and look at the parameter 'centers'.

Roberto
http://roberto.perdisci.googlepages.com

On Nov 14, 2007 6:07 PM, Alejandro Rodríguez <rodrigueza at schwabe.com.mx> wrote:
>
> Hello, I'm new using R.
>
> I'm trying to develop a K-means Clustering with R for some data I have,
> however each time I use that instruction with the same data my cluster
> means, clustering vector and within cluster sum of square change and I don't
> understand why because I use the same parameters and the same data.
>
> Can anybody explain me why does it happen?
>
> Thank you
>
>
>
> Act. Calef Alejandro Rodríguez Cuevas
> Analista de mercado
>
> Laboratorios Farmasa S.A. de C.V.
> Schwabe Mexico, S.A. de C.V.
>
> Bufalo Nr. 27
> Col. del Valle 03100
> Mexico, D.F.
> Mexico
>
> Tel. 52 00 26 80
> email: rodrigueza at schwabe.com.mx
>
> www.schwabe.com.mx
> www.umckaloabo.com.mx
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list