kmeanspp {motifcluster} | R Documentation |
kmeans++ clustering
Description
Use the kmeans++ algorithm to cluster points
into k
clusters, as implemented in the
deprecated LICORS package, using the
built-in function kmeans.
Usage
kmeanspp(data, k = 2, iter.max = 100, nstart = 10, ...)
Arguments
data |
An |
k |
The number of clusters. |
iter.max |
The maximum number of iterations. |
nstart |
The number of restarts. |
... |
Additional arguments passed to |
Value
A list with 9 entries:
-
cluster
: A vector of integers from 1:k indicating the cluster to which each point is allocated. -
centers
: A matrix of cluster centers. -
totss
: The total sum of squares. -
withinss
: Vector of within-cluster sum of squares, one component per cluster. -
tot.withinss
: Total within-cluster sum of squares, i.e.sum(withinss). -
betweenss
: The between-cluster sum of squares, i.e.totss-tot.withinss. -
size
: The number of points in each cluster. -
iter
: The number of (outer) iterations. -
ifault
: An integer indicator of a possible algorithm problem. -
initial.centers
: The initial centers used.
References
Arthur, D. and S. Vassilvitskii (2007). “k-means++: The advantages of careful seeding.” In H. Gabow (Ed.), Proceedings of the 18th Annual ACM-SIAM Symposium on Discrete Algorithms [SODA07], Philadelphia, pp. 1027-1035. Society for Industrial and Applied Mathematics.
See Also
Examples
set.seed(1984)
n <- 100
X = matrix(rnorm(n), ncol = 2)
Y = matrix(runif(length(X)*2, -1, 1), ncol = ncol(X))
Z = rbind(X, Y)
cluster_Z = kmeanspp(Z, k = 5)