Learn R Programming

RclusTool (version 0.91.61)

FindNumberK: Automatic estimation of the number of clusters

Description

Compute gap on a similarity matrix obtained from raw data matrix to estimate the number of clusters automatically.

Usage

FindNumberK(features, Kmax, StopCriteria = 0.99, graph = FALSE)

Value

K number of clusters obtained.

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.

Details

FindNumberK return K number according spectral gap on reduced points

Examples

Run this code
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 <- FindNumberK(dat, Kmax=20, graph=TRUE)

Run the code above in your browser using DataLab