kmeansDist function

k-means Clustering using a distance matrix

k-means Clustering using a distance matrix

Perform k-means clustering on a distance matrix

kmeansDist(Distance, ClusterNo=2,Centers=NULL, RandomNo=1,maxIt = 2000, PlotIt=FALSE,verbose = F)

Arguments

  • Distance: Distance matrix. For n data points of the dimension n x n
  • ClusterNo: A number k which defines k different clusters to be built by the algorithm.
  • Centers: Default(NULL) a set of initial (distinct) cluster centres.
  • RandomNo: If>1: Number of random initializations with searching for minimal SSE is defined by this scalar
  • maxIt: Optional: Maximum number of iterations before the algorithm terminates.
  • PlotIt: Default: FALSE, If TRUE plots the first three dimensions of the dataset with colored three-dimensional data points defined by the clustering stored in Cls
  • verbose: Optional: Algorithm always outputs current iteration.

Returns

  • Cls[1:n]: [1:n] numerical vector with n numbers defining the classification as the main output of the clustering algorithm. It has k unique numbers representing the arbitrary labels of the clustering.

  • centerids[1:k]: Indices of the centroids from which the cluster Cls was created

Author(s)

Felix Pape, Michael Thrun

Note

Currently an experimental version

Examples

data('Hepta') #out=kmeansDist(as.matrix(dist(Hepta$Data)),ClusterNo=7,PlotIt=FALSE,RandomNo = 10) ## Not run: data('Leukemia') #as expected does not perform well #for non-spherical cluster structures: #out=kmeansDist(Leukemia$DistanceMatrix,ClusterNo=6,PlotIt=TRUE,RandomNo=10) ## End(Not run)
  • Maintainer: Michael Thrun
  • License: GPL-3
  • Last published: 2023-10-19

Downloads (last 30 days):