kmeansDist: k-means Clustering using a distance matrix

View source: R/kmeansDist.R

kmeansDistR Documentation

k-means Clustering using a distance matrix

Description

Perform k-means clustering on a distance matrix

Usage

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.

Value

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

Note

Currently an experimental version

Author(s)

Felix Pape, Michael Thrun

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)

FCPS documentation built on Oct. 19, 2023, 5:06 p.m.