Aricode
R package for computation of (adjusted) rand-index and other such scores
Install / Use
/learn @jchiquet/AricodeREADME
aricode: fast computations of clustering comparison measures
aricode
<!-- badges: start --> <!-- badges: end -->A package for efficient computations of standard clustering comparison measures
Installation
Stable version on the CRAN.
install.packages("aricode")
The development version is available via:
devtools::install_github("jchiquet/aricode")
Description
Computation of measures for clustering comparison (ARI, AMI, NID and
even the $\chi^2$ distance) are usually based on the contingency table.
Traditional implementations (e.g., function adjustedRandIndex of
package mclust) are in $\Omega(n + u v)$ where
- $n$ is the size of the vectors the classifications of which are to be compared,
- $u$ and $v$ are the respective number of classes in each vectors.
In aricode we propose an implementation, based on radix sort, that
is in $\Theta(n)$ in time and space.
Importantly, the complexity does not depends on $u$ and $v$. Our
implementation of the ARI for instance is one or two order of magnitude
faster than some standard implementation in R.
Available measures and functions
The functions included in aricode are:
AMI: computes the adjusted mutual informationARI/RI: computes the (adjusted) Rand indexChi2: computes the Chi-square statisticsFrobeniuscompute the Frobenius norm between two classification as defined in Arlot et al, 2019MARI/MARIraw: computes the modified adjusted rand index as defined in Sundqvist et al, 2023NID: computes the normalized information distanceNMI: computes the normalized mutual informationNVI: computes the the normalized variation informationexpected_MI: computes the expected mutual informationentropy: computes the conditional and joint entropiesclustComp: computes all clustering comparison measures at once
Timings
Here are some timings to compare the cost of computing the adjusted Rand
Index with aricode or with the commonly used function
adjustedRandIndex of the mclust package: the cost of the latter can
be prohibitive for large vectors:


