KmeansAutoElbow: Kmeans clustering with automatic estimation of number of...

View source: R/KmeansAutoElbow.R

KmeansAutoElbowR 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

KmeansQuick

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")


RclusTool documentation built on Aug. 29, 2022, 9:07 a.m.