kmeansW | R Documentation |
It is a modification of kmeans Hartigan-Wong algorithm to consider the weight of the elements to classify.
kmeansW(x, centers, weight = rep(1,nrow(x)),
iter.max = 10, nstart = 1)
x |
A numeric vector, matrix or data frame. |
centers |
Either the number of clusters or a set of initial (distinct) cluster centres. If a number, a random set of (distinct) rows in x is chosen as the initial centres. |
weight |
weight of the elements of x. by default the same. |
iter.max |
The maximum number of iterations allowed. |
nstart |
If centers is a number, how many random sets should be chosen? |
With the 'Hartigan-Wong' algorithm, this function performs the K-means clustering diminishing inertia intra classes. In this version the Fortran code kmnsW.f was changed by C++ code kmeanw.cc programed by Camilo Jose Torres, modifing C code programed by Burkardt.
object of class FactoClass.tex
with the following characteristics:
cluster |
vector indicating the cluster of each element. |
... |
Camilo Jose Torres cjtorresj@unal.edu.co, Campo Elias Pardo cepardot@unal.edu.co
Hartigan, J. A. and Wong, M. A. (1979). A K-means clustering algorithm. Applied Statistics 28, 100–108.
Burkardt, J. (2008). ASA136 The K-Means Algorithm. https://people.sc.fsu.edu/~jburkardt/cpp_src/asa136/asa136.html
data(Bogota)
ac.bog <- Bogota[-1]
il.bog <- Bogota[ 1]
acs <- dudi.coa( ac.bog, nf=6 , scannf = FALSE )
kmeansW( acs$li, 7, acs$lw )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.