Last chance! 50% off unlimited learning
Sale ends in
cmeans (x, centers, iter.max=100, verbose=FALSE, dist="euclidean",
method="cmeans", m=2, rate.par = NULL)
TRUE
, make some output during learning"euclidean"
, the
mean square error, if "manhattan"
, the mean absolute error is
computed. Abbreviations are also accepted."cmeans"
, then we have the cmeans fuzzy
clustering method, if "ufcl"
we have the On-line Update. Abbreviations in the method names are also accepted.cmeans
returns an object of class "fclust"
.x
is clustered by the fuzzy kmeans algorithm.
If centers
is a matrix, its rows are taken as the initial cluster
centers. If centers
is an integer, centers
rows
of x
are randomly chosen as initial values.
The algorithm stops when the maximum number of iterations (given by
iter.max
) is reached. If verbose
is TRUE
, it displays for each iteration the number
the value of the objective function.
If dist
is "euclidean"
, the distance between the
cluster center and the data points is the Euclidean distance (ordinary
fuzzy kmeans algorithm). If "manhattan"
, the distance
between the cluster center and the data points is the sum of the
absolute values of the distances of the coordinates.
If method
is "cmeans"
, then we have the kmeans fuzzy
clustering method. If "ufcl"
we have the On-line Update
(Unsupervised Fuzzy Competitive learning) method, which works by
performing an update directly after each input signal.
The parameters m
defines the degree of fuzzification. It is
defined for real values greater than 1 and the bigger it is the more
fuzzy the membership values of the clustered data points are.
The parameter rate.par
of the learning rate for the "ufcl"
algorithm which is by default set to rate.par=0.3
and is taking
real values in (0 , 1).
# a 2-dimensional example
x<-rbind(matrix(rnorm(100,sd=0.3),ncol=2),
matrix(rnorm(100,mean=1,sd=0.3),ncol=2))
cl<-cmeans(x,2,20,verbose=TRUE,method="cmeans",m=2)
print(cl)
# a 3-dimensional example
x<-rbind(matrix(rnorm(150,sd=0.3),ncol=3),
matrix(rnorm(150,mean=1,sd=0.3),ncol=3),
matrix(rnorm(150,mean=2,sd=0.3),ncol=3))
cl<-cmeans(x,6,20,verbose=TRUE,method="cmeans")
print(cl)
# assign classes to some new data
y<-rbind(matrix(rnorm(33,sd=0.3),ncol=3),
matrix(rnorm(33,mean=1,sd=0.3),ncol=3),
matrix(rnorm(3,mean=2,sd=0.3),ncol=3))
# ycl<-predict(cl, y, type="both")
Run the code above in your browser using DataLab