Learn R Programming

visxhclust (version 1.1.0)

compute_metric: Compute an internal evaluation metric for clustered data

Description

Metric will be computed from 2 to max_k clusters. Note that the row number in results will be different from k.

Usage

compute_metric(dmat, clusters, metric_name, max_k = 14)

Value

a data frame with columns k and score

Arguments

dmat

distance matrix output of compute_dmat() or stats::dist()

clusters

output of compute_clusters() or fastcluster::hclust()

metric_name

"silhouette" or "dunn"

max_k

maximum number of clusters to cut using dendextend::cutree(). Default is 14.

Examples

Run this code
data_to_cluster <- iris[c("Petal.Length", "Sepal.Length")]
dmat <- compute_dmat(data_to_cluster, "euclidean", TRUE)
clusters <- compute_clusters(dmat, "complete")
compute_metric(dmat, clusters, "dunn")

Run the code above in your browser using DataLab