agreement | R Documentation |
Calculates the agreement between two partitions, typically the known actual cluster labels and the predicted cluster labels.
agreement(predicted, actual, method = "cRand", na_as_cluster = TRUE)
predicted |
a vector with predicted cluster labels. |
actual |
the known cluster labels (ground truth). |
method |
the used method (see |
na_as_cluster |
logical; should |
This convenience function is an interface to clue::cl_agreement()
. See methods
in that man page
for a list of available methods. A measure typically used for clustering is the corrected Rand index
(also called adjusted Rand index). Numbers close to 1 indicate a very good agreement.
Hornik K (2005). A CLUE for CLUster Ensembles. Journal of Statistical Software, 14(12). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v014.i12")}
# Perfect agreement (1 and 2 are just switched)
actual <- c(2, 2, 1, 3, 2, NA)
predicted <- c(1, 1, 2, 3, 1, NA)
agreement(actual, predicted)
# No agreement
predicted <- sample(predicted)
agreement(actual, predicted)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.