Skip to contents

KmeansLloyd: Lloyd (1982) iterations from given centres, as kmeans(algorithm = "Lloyd"). PamMedoids: BUILD and SWAP (Kaufman and Rousseeuw 1990) as cluster::pam, clusters numbered by first appearance. Identical to the Python arm morie.fn.clusops.

Usage

KmeansLloyd(X, centers, maxit = 100L)

PamMedoids(D, k)

Arguments

X

Data matrix.

centers

Initial centres (matrix).

maxit

Maximum iterations.

D

Dissimilarity matrix.

k

Number of medoids.

Value

List.

References

Lloyd, S. P. (1982). Least squares quantization in PCM. IEEE Transactions on Information Theory 28, 129-137.

Kaufman, L. and Rousseeuw, P. J. (1990). Finding Groups in Data. Wiley.

Examples

KmeansLloyd(rbind(c(0, 0), c(0, 1), c(5, 5), c(5, 6)), rbind(c(0, 0), c(5, 5)))$cluster
#> [1] 1 1 2 2
PamMedoids(rbind(c(0, 1, 5, 6), c(1, 0, 4, 5), c(5, 4, 0, 1), c(6, 5, 1, 0)), 2)$medoids
#> [1] 2 3