Skip to contents

Create a table containing four validation metrics for clustering: Purity, F-measure and Rand Index (RI) and Adjusted Rand Index (ARI). This function considers pairs of points

Usage

clustering_validation(clusters, true_labels, digits = 4)

Arguments

clusters

The clusters predicted by the clustering method.

true_labels

Atomic vector with the true labels of the data.

digits

Number of digits for rounding.

Value

A list containing values for Purity, F-measure, RI and ARI.

Examples

set.seed(1221)
vars <- list(c("dtaEI", "dtaMEI"))
data <- sim_model_ex1()
true_labels <- c(rep(1, 50), rep(2, 50))
data_ind <- generate_indices(data)
clus_kmeans <- clustInd_kmeans(data_ind, vars)
cluskmeans_mahalanobis_dtaEIdtaMEI <- clus_kmeans$kmeans_mahalanobis_dtaEIdtaMEI$cluster
clustering_validation(cluskmeans_mahalanobis_dtaEIdtaMEI, true_labels)
#> $Purity
#> [1] 0.75
#> 
#> $Fmeasure
#> [1] 0.6193
#> 
#> $RI
#> [1] 0.6212
#> 
#> $ARI
#> [1] 0.2424
#>