Skip to contents

Calculate the classification accuracy for each cluster

Usage

per_cluster_accuracy(cmat)

Arguments

cmat

Confusion matrix (rows = true, cols = predicted)

Value

Named numeric vector of per-cluster accuracies

Examples

cmat <- matrix(c(90, 5, 5, 3, 85, 12, 2, 10, 88), nrow = 3)
rownames(cmat) <- colnames(cmat) <- c("A", "B", "C")
per_cluster_accuracy(cmat)
#>         A         B         C 
#> 0.9473684 0.8500000 0.8380952