Rand index

From testwiki
Jump to navigation Jump to search

Template:Short description

File:Example for Adjusted Rand index.svg
Example clusterings for a dataset with the kMeans (left) and Mean shift (right) algorithms. The calculated Adjusted Rand index for these two clusterings is ARI0.94

The Rand index[1] or Rand measure (named after William M. Rand) in statistics, and in particular in data clustering, is a measure of the similarity between two data clusterings. A form of the Rand index may be defined that is adjusted for the chance grouping of elements, this is the adjusted Rand index. The Rand index is the accuracy of determining if a link belongs within a cluster or not.

Rand index

Definition

Given a set of n elements S={o1,,on} and two partitions of S to compare, X={X1,,Xr}, a partition of S into r subsets, and Y={Y1,,Ys}, a partition of S into s subsets, define the following:

  • a, the number of pairs of elements in S that are in the same subset in X and in the same subset in Y
  • b, the number of pairs of elements in S that are in different subsets in X and in different subsets in Y
  • c, the number of pairs of elements in S that are in the same subset in X and in different subsets in Y
  • d, the number of pairs of elements in S that are in different subsets in X and in the same subset in Y

The Rand index, R, is:[1][2]

R=a+ba+b+c+d=a+b(n2)

Intuitively, a+b can be considered as the number of agreements between X and Y and c+d as the number of disagreements between X and Y.

Since the denominator is the total number of pairs, the Rand index represents the frequency of occurrence of agreements over the total pairs, or the probability that X and Y will agree on a randomly chosen pair.

(n2) is calculated as n(n1)/2.

Similarly, one can also view the Rand index as a measure of the percentage of correct decisions made by the algorithm. It can be computed using the following formula:

RI=TP+TNTP+FP+FN+TN
where TP is the number of true positives, TN is the number of true negatives, FP is the number of false positives, and FN is the number of false negatives.

Properties

The Rand index has a value between 0 and 1, with 0 indicating that the two data clusterings do not agree on any pair of points and 1 indicating that the data clusterings are exactly the same.

In mathematical terms, a, b, c, d are defined as follows:

  • a=|S*|, where S*={(oi,oj)oi,ojXk,oi,ojYl}
  • b=|S*|, where S*={(oi,oj)oiXk1,ojXk2,oiYl1,ojYl2}
  • c=|S*|, where S*={(oi,oj)oi,ojXk,oiYl1,ojYl2}
  • d=|S*|, where S*={(oi,oj)oiXk1,ojXk2,oi,ojYl}

for some 1i,jn,ij,1k,k1,k2r,k1k2,1l,l1,l2s,l1l2

Relationship with classification accuracy

The Rand index can also be viewed through the prism of binary classification accuracy over the pairs of elements in S. The two class labels are "oi and oj are in the same subset in X and Y" and "oi and oj are in different subsets in X and Y".

In that setting, a is the number of pairs correctly labeled as belonging to the same subset (true positives), and b is the number of pairs correctly labeled as belonging to different subsets (true negatives).

Adjusted Rand index

The adjusted Rand index is the corrected-for-chance version of the Rand index.[1][2][3] Such a correction for chance establishes a baseline by using the expected similarity of all pair-wise comparisons between clusterings specified by a random model. Traditionally, the Rand Index was corrected using the Permutation Model for clusterings (the number and size of clusters within a clustering are fixed, and all random clusterings are generated by shuffling the elements between the fixed clusters). However, the premises of the permutation model are frequently violated; in many clustering scenarios, either the number of clusters or the size distribution of those clusters vary drastically. For example, consider that in K-means the number of clusters is fixed by the practitioner, but the sizes of those clusters are inferred from the data. Variations of the adjusted Rand Index account for different models of random clusterings.[4]

Though the Rand Index may only yield a value between 0 and +1, the adjusted Rand index can yield negative values if the index is less than the expected index.[5]

The contingency table

Given a set Template:Mvar of Template:Mvar elements, and two groupings or partitions (e.g. clusterings) of these elements, namely X={X1,X2,,Xr} and Y={Y1,Y2,,Ys}, the overlap between Template:Mvar and Template:Mvar can be summarized in a contingency table [nij] where each entry nij denotes the number of objects in common between Xi and Yj : nij=|XiYj|.

XYY1Y2YssumsX1n11n12n1sa1X2n21n22n2sa2Xrnr1nr2nrsarsumsb1b2bs

Definition

The original Adjusted Rand Index using the Permutation Model is

ARI=ij(nij2)[i(ai2)j(bj2)]/(n2)12[i(ai2)+j(bj2)][i(ai2)j(bj2)]/(n2)

where nij,ai,bj are values from the contingency table.

See also

References

Template:Reflist

Template:Machine learning evaluation metrics