KmeansAutoElbow {RclusTool} | R Documentation |
Kmeans clustering with automatic estimation of number of clusters
Description
Perform Elbow method and kmeans algorithm for the automatic estimation of the number of clusters and data clustering.
Usage
KmeansAutoElbow(
features,
Kmax,
StopCriteria = 0.99,
graph = FALSE,
Elbow = TRUE
)
Arguments
features |
matrix of raw data (point by line). |
Kmax |
maximum number of clusters. |
StopCriteria |
elbow method cumulative explained variance > criteria to stop K-search. |
graph |
boolean: if TRUE, figures for total of within-class inertia and explained variance are plotted. |
Elbow |
boolean: if TRUE, Elbow method is used for finding the knee point of a curve. |
Details
KmeansAutoElbow return partition and K number of groups according to kmeans clustering and Elbow method
Value
The function returns a list containing:
K |
number of clusters obtained by Elbow method. |
res.kmeans |
results obtained from kmeans algorithm. |
See Also
Examples
dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
res <- KmeansAutoElbow(dat, Kmax=20, graph=TRUE)
plot(dat[,1], dat[,2], type = "p", xlab = "x", ylab = "y",
col = res$res.kmeans$cluster, main = "K-means clustering")
[Package RclusTool version 0.91.6 Index]