Description Usage Arguments Details Value Examples
For two clusterings of the same data set, this function calculates the similarity statistic specified of the clusterings from the comemberships of the observations. Basically, the comembership is defined as the pairs of observations that are clustered together.
1 2 3 | cluster_similarity(labels1, labels2,
similarity = c("jaccard", "rand"),
method = "independence")
|
labels1 |
a vector of |
labels2 |
a vector of |
similarity |
the similarity statistic to calculate |
method |
the model under which the statistic was derived |
To calculate the similarity, we compute the 2x2 contingency table, consisting of the following four cells:
the number of observation pairs where both observations are comembers in both clusterings
the number of observation pairs where the observations are comembers in the first clustering but not the second
the number of observation pairs where the observations are comembers in the second clustering but not the first
the number of observation pairs where neither pair are comembers in either clustering
Currently, we have implemented the following similarity statistics:
Rand index
Jaccard coefficient
To compute the contingency table, we use the
comembership_table
function.
the similarity between the two clusterings
1 2 3 4 |
[1] 0.560947
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.