Skip to contents

Computes the Adjusted Rand Index between true and predicted cluster assignments. This is a NA-safe wrapper around mclust::adjustedRandIndex.

Usage

compute_ari(true_cluster, pred_cluster)

Arguments

true_cluster

Integer vector of true cluster assignments.

pred_cluster

Integer vector of predicted cluster assignments.

Value

Numeric scalar: ARI value in [-1, 1], where 1 indicates perfect agreement. Returns NA if inputs are invalid or mclust is not available.

Details

The Adjusted Rand Index (ARI) measures the similarity between two clusterings, adjusted for chance. It is commonly used to evaluate clustering accuracy when ground truth is available.

Examples

if (FALSE) { # \dontrun{
true_cluster <- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
pred_cluster <- c(1, 1, 2, 2, 2, 2, 3, 3, 3)
ari <- compute_ari(true_cluster, pred_cluster)
} # }