optimal_score: Find minimum or maximum score in a vector

View source: R/utils_clustering.R

optimal_scoreR Documentation

Find minimum or maximum score in a vector

Description

This function is meant to be used with compute_metric. For Gap statistic, use cluster::maxSE().

Usage

optimal_score(x, method = c("firstmax", "globalmax", "firstmin", "globalmin"))

Arguments

x

a numeric vector

method

one of "firstmax", "globalmax", "firstmin" or "globalmin"

Value

the index (not k) of the identified maximum or minimum score

Examples

data_to_cluster <- iris[c("Petal.Length", "Sepal.Length")]
dmat <- compute_dmat(data_to_cluster, "euclidean", TRUE)
clusters <- compute_clusters(dmat, "complete")
res <- compute_metric(dmat, clusters, "dunn")
optimal_score(res$score, method = "firstmax")

visxhclust documentation built on March 31, 2023, 7:30 p.m.