Learn R Programming

helda (version 1.1.5)

compute_inertia_ahc: Intra group inertia for choosing the optimal number of clusters in Agglomerative Clustering

Description

This function allows to compute the inter group inertia from agglomerative clustering for different number of clusters

Usage

compute_inertia_ahc(data, method = "ward.D", max_clusters = 10)

Arguments

data

a R data frame (all columns are required to be numeric types).

method

a character. This specifies the method on which the agglomerative is built upon (by default set to "ward.D")

max_clusters

an integer. The maximal number of clusters for which we intend to compute inter group inertia

Value

a vector of length max_clusters containing the inter group inertia for agglomerative clustering. The ith value of the vector corresponds to the inter group inertia from agglomerative clustering run with i clusters.

References

Link to the author's github package repository: https://github.com/Redcart/helda

Examples

Run this code
# NOT RUN {
library(dplyr)
# We select only numeric features from Iris data set
data <- iris %>% select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
result <- compute_inertia_ahc(data = data, max_clusters = 15)
result
# }

Run the code above in your browser using DataLab