rankkmed {kmed} | R Documentation |
Rank k-medoid algorithm
Description
This function runs the rank k-medoids algorithm proposed by Zadegan et. al. (2013).
Usage
rankkmed(distdata, ncluster, m = 3, iterate = 10, init = NULL)
Arguments
distdata |
A distance matrix (n x n) or dist object. |
ncluster |
A number of clusters. |
m |
A number of objects to compute hostility (see Details). |
iterate |
A number of iterations for the clustering algorithm. |
init |
A vector of initial objects as the cluster medoids (see Details). |
Details
This algorithm is claimed to cope with the local optima problem
of the simple and fast-kmedoids algorithm (fastkmed
). The
m
argument is defined by the user and has to be 1 < m \leq n
.
The m
is a hostility measure computed by
m_i = \sum_{X_j \in Y} r_{ij}
where x_j
is the object j, Y is the set of objects
as many as m, and r_{ij}
is the rank distance, i.e. sorted
distance, between object i and j.
init
can be provided with a vector of id objects. The length of
the vector has to be equal to the number of clusters. However, assigning
a vector in the init
argument, the algorithm is no longer the rank
k-medoids algorithm.
Value
Function returns a list of components:
cluster
is the clustering memberships result.
medoid
is the id medoids.
minimum_distance
is the distance of all objects to their cluster
medoid.
Author(s)
Weksi Budiaji
Contact: budiaji@untirta.ac.id
References
Zadegan, S.M.R, Mirzaie M, and Sadoughi, F. 2013. Ranked k-medoids: A fast and accurate rank-based partitioning algorithm for clustering large datasets. Knowledge-Based Systems 39, 133-143.
Examples
num <- as.matrix(iris[,1:4])
mrwdist <- distNumeric(num, num, method = "mrw")
result <- rankkmed(mrwdist, ncluster = 3, iterate = 50)
table(result$cluster, iris[,5])