kcca(x, k, family=kccaFamily("kmeans"), weights=NULL, group=NULL, control=NULL, simple=FALSE, save.data=FALSE)
kccaFamily(which=NULL, dist=NULL, cent=NULL, name=which, preproc = NULL, trim=0, groupFun = "minSumClusters")
"summary"(object)x is chosen as the initial centroids.kccaFamily.flexclustControl.kccasimple?x in the return object?"kmeans", "kmedians",
    "angle", "jaccard", or "ejaccard".which is specified.which is specified.kmeans family, ignored by all other
    families."kcca".kcca returns objects of class "kcca" or
  "kccasimple" depending on the value of argument
  simple. The simpler objects contain fewer slots and hence are
  faster to compute, but contain no auxiliary information used by the
  plotting methods. Most plot methods for "kccasimple" objects do
  nothing and return a warning. If only centroids, cluster membership or
  prediction for new data are of interest, then the simple objects are
  sufficient.
kccaFamily() currently has the following predefined
  families (distance / centroid):
  group is not NULL, then observations from the same
  group are restricted to belong to the same cluster (must-link
  constraint) or different clusters (cannot-link constraint) during the
  fitting process. If groupFun = "minSumClusters", then all group
  members are 
  assign to the cluster where the center has minimal average distance to
  the group members. If groupFun = "majorityClusters", then all
  group members are assigned to the cluster the majority would belong to
  without a constraint. groupFun = "differentClusters" implements a cannot-link
  constraint, i.e., members of one group are not allowed to belong to
  the same cluster. The optimal allocation for each group is found by
  solving a linear sum assignment problem using
  solve_LSAP. Obviously the group sizes must be smaller
  than the number of clusters in this case. Ties are broken at random in all cases.
  Note that at the moment not all methods for fitted
  "kcca" objects respect the grouping information, most
  importantly the plot method when a data argument is specified.Friedrich Leisch and Bettina Gruen. Extending standard cluster algorithms to allow for group constraints. In Alfredo Rizzi and Maurizio Vichi, editors, Compstat 2006-Proceedings in Computational Statistics, pages 885-892. Physica Verlag, Heidelberg, Germany, 2006.
stepFlexclust, cclust,
  distancesdata("Nclus")
plot(Nclus)
## try kmeans 
cl1 = kcca(Nclus, k=4)
cl1
image(cl1)
points(Nclus)
## A barplot of the centroids 
barplot(cl1)
## now use k-medians and kmeans++ initialization, cluster centroids
## should be similar...
cl2 = kcca(Nclus, k=4, family=kccaFamily("kmedians"),
           control=list(initcent="kmeanspp"))
cl2
## ... but the boundaries of the partitions have a different shape
image(cl2)
points(Nclus)
Run the code above in your browser using DataLab