Learn R Programming

kmed (version 0.0.1)

fastkmed: A simple and fast k-medoid algorithm from Park and Jun.

Description

This function computes and returns the clustering result computed by using a specified distance via Park and Jun's k-medoids.

Usage

fastkmed(distdata, ncluster, iterate = 10)

Arguments

distdata

A matrix of distance objects (n x n) or a diss class.

ncluster

A number of cluster.

iterate

A number of iteration for clustering algorithm.

Value

Function returns a partitioning clustering algorithm result consists of cluster membership, cluster medoid, the minimum distance to the cluster medoid.

Details

This is a two-data-set equivalent of the standard function of distance. It returns a matrix of all pairwise distances between rows in data1 and data2. For a list of available numerical distance, binary and categorical distance, one can search by distname()

References

Park, H., Jun, C., 2009. A simple and fast algorithm for k-medoids clustering. Expert Systems with Applications 36, 3336-3341.

Examples

Run this code
# NOT RUN {
num <- as.matrix(iris[,1:4])
mrwdist <- distNumeric(num, num, method = "mrw")
result <- fastkmed(mrwdist, ncluster = 3, iterate = 50)
table(result$cluster, iris[,5])


# }

Run the code above in your browser using DataLab