compare: Comparison of two sets of clusters

compareR Documentation

Comparison of two sets of clusters

Description

Comparison of two sets of clusters

Usage

compare(clus, gt, eval = "accuracy", comp = c("max", "pairwise", "cluster"))

Arguments

clus

The extracted clusters.

gt

The real clusters.

eval

The evaluation criterion.

comp

How the two partitions are compared: "max" (each cluster matched with the class it agrees with most, averaged over clusters), "cluster" (the same scores, not averaged) or "pairwise" (every pair of observations, labels ignored). In "pairwise" mode the three criteria are three classical indices built on the same pair counts: "accuracy" is the Rand index, "jaccard" the Jaccard index on pairs, and "kappa" Cohen's kappa on the fourfold table of pair agreements (which, by Warrens (2008), is also the adjusted Rand index). See compare.accuracy, compare.jaccard and compare.kappa.

Value

A numeric value indicating how much the two sets of clusters are similar.

See Also

compare.accuracy, compare.jaccard, compare.kappa, intern, stability

Examples

require (datasets)
data (iris)
km = KMEANS (iris [, -5], k = 3)
compare (km$cluster, iris [, 5])
## Not run: 
compare (km$cluster, iris [, 5], eval = c ("accuracy", "kappa"), comp = "pairwise")

## End(Not run)

fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.