Adjusted Rand Index Calculator
Inputs
- Inputs: 100 items, 1,200 pairs placed together in both clusterings, 1,800 pairs together in the first clustering and 1,600 in the second.
- There are 100 x 99 / 2 = 4,950 item pairs in total; chance alone would put 1,800.00 x 1,600.00 / 4,950 = 581.82 of them together in both.
- Adjusted Rand index = (1,200 - 581.82) / (1,700.00 - 581.82) = 0.5528, where 1,700.00 is the average of the two together-counts.
- The unadjusted Rand index is 0.7980; the adjustment pulls it down to 0.5528 by removing the agreement two random clusterings would get for free.
How similar are two ways of grouping the same items? The adjusted Rand index answers by counting pairs. Two items can be together in both clusterings, apart in both, or together in one and apart in the other - and the pattern of those pair counts measures agreement. Enter the total items and the three pair counts, and the calculator returns the chance-corrected index alongside the raw Rand index.
The chance correction is the point. Two random clusterings of the same items agree on a surprising number of pairs, especially when clusters are large, and the raw Rand index happily credits that luck as similarity. The adjustment subtracts it.
Worked examples
Moderate agreement, 100 items
(100 · 1200 · 1800 · 1600)
| Adjusted Rand index | 0.5528 |
| Rand index | 0.7980 |
| Expected pair agreement by chance | 581.82 |
| Pairs in different clusters in both | 2,750 |
Compact test, 50 items
(50 · 300 · 420 · 380)
| Adjusted Rand index | 0.6292 |
| Rand index | 0.8367 |
| Expected pair agreement by chance | 130.29 |
| Pairs in different clusters in both | 725 |
Large sample, strong agreement
(200 · 5200 · 6100 · 5900)
| Adjusted Rand index | 0.8091 |
| Rand index | 0.9196 |
| Expected pair agreement by chance | 1,808.54 |
| Pairs in different clusters in both | 13,100 |
Counting pairs instead of points
With n items there are n(n-1)/2 pairs - 4,950 pairs for the 100 items of the first worked example. Each pair falls into one of four cells defined by whether the two clusterings put its items together or apart. The Rand index is the share of pairs the clusterings treat the same way: together in both, or apart in both.
In the first example, 1,200 pairs are together in both clusterings and 2,750 are apart in both, so the raw Rand index is (1,200 + 2,750) / 4,950 = 0.7980. That looks like strong agreement - until chance is priced in.
- Only the pair-count aggregates are needed, not the full contingency table.
- The pair counts must be consistent: pairs together in both cannot exceed the together-count of either clustering.
- The index treats the two clusterings symmetrically - swapping them changes nothing.
The chance correction, step by step
Under random labelling with the same cluster sizes, the expected number of pairs together in both is the product of the two together-counts divided by the total pairs: 1,800 x 1,600 / 4,950 = 581.82 in the first example. The maximum achievable is the average of the two together-counts, 1,700. The adjusted index is the observed excess over chance as a share of the possible excess: (1,200 - 581.82) / (1,700 - 581.82) = 0.5528.
The correction bites hardest exactly where intuition fails - few, large clusters. The compact second example adjusts from a raw 0.8367 down to 0.6292, and even the large third example, with a raw index of 0.9196, settles at 0.8091 once its 1,808.54 chance pairs are removed.
| Example | Items | Raw Rand | Expected by chance | ARI |
|---|---|---|---|---|
| First | 100 | 0.7980 | 581.82 | 0.5528 |
| Second | 50 | 0.8367 | 130.29 | 0.6292 |
| Third | 200 | 0.9196 | 1,808.54 | 0.8091 |
Worked examples
Example 1: Total items clustered 100; Pairs together in both clusterings 1200; Pairs together in the first clustering 1800; Pairs together in the second clustering 1600. Adjusted Rand index = 0.5528. Supporting values: Rand index 0.7980; Expected pair agreement by chance 581.82; Pairs in different clusters in both 2,750. Inputs: 100 items, 1,200 pairs placed together in both clusterings, 1,800 pairs together in the first clustering and 1,600 in the second. There are 100 x 99 / 2 = 4,950 item pairs in total; chance alone would put 1,800.00 x 1,600.00 / 4,950 = 581.82 of them together in both. Adjusted Rand index = (1,200 - 581.82) / (1,700.00 - 581.82) = 0.5528, where 1,700.00 is the average of the two together-counts. The unadjusted Rand index is 0.7980; the adjustment pulls it down to 0.5528 by removing the agreement two random clusterings would get for free.
Example 2: Total items clustered 50; Pairs together in both clusterings 300; Pairs together in the first clustering 420; Pairs together in the second clustering 380. Adjusted Rand index = 0.6292. Supporting values: Rand index 0.8367; Expected pair agreement by chance 130.29; Pairs in different clusters in both 725. Inputs: 50 items, 300 pairs placed together in both clusterings, 420 pairs together in the first clustering and 380 in the second. There are 50 x 49 / 2 = 1,225 item pairs in total; chance alone would put 420.00 x 380.00 / 1,225 = 130.29 of them together in both. Adjusted Rand index = (300 - 130.29) / (400.00 - 130.29) = 0.6292, where 400.00 is the average of the two together-counts. The unadjusted Rand index is 0.8367; the adjustment pulls it down to 0.6292 by removing the agreement two random clusterings would get for free.
Example 3: Total items clustered 200; Pairs together in both clusterings 5200; Pairs together in the first clustering 6100; Pairs together in the second clustering 5900. Adjusted Rand index = 0.8091. Supporting values: Rand index 0.9196; Expected pair agreement by chance 1,808.54; Pairs in different clusters in both 13,100. Inputs: 200 items, 5,200 pairs placed together in both clusterings, 6,100 pairs together in the first clustering and 5,900 in the second. There are 200 x 199 / 2 = 19,900 item pairs in total; chance alone would put 6,100.00 x 5,900.00 / 19,900 = 1,808.54 of them together in both. Adjusted Rand index = (5,200 - 1,808.54) / (6,000.00 - 1,808.54) = 0.8091, where 6,000.00 is the average of the two together-counts. The unadjusted Rand index is 0.9196; the adjustment pulls it down to 0.8091 by removing the agreement two random clusterings would get for free.
ARI versus the raw Rand index
The raw index has a seductive scale problem: its floor is not zero but whatever chance delivers, and that floor rises with cluster size imbalance. Two clusterings can post a raw Rand of 0.7980 while being, in the adjusted view, barely past halfway to perfect agreement. The adjusted index restores a meaningful zero - 0 means chance-level agreement - and allows 1.00 for identical partitions and negative values for agreement worse than chance.
That calibration is why the adjusted index became the default external validity measure in clustering benchmarks, and why reporting the raw index alone is now considered a methodological slip.
Reading values and known blind spots
As a rough field guide, values above 0.80 indicate strong agreement, 0.50 to 0.80 moderate, and below 0.50 weak - though the right reading always depends on the number of clusters and items. The first example's 0.5528 is a genuinely moderate match: the two partitions share real structure but differ on many borderline items.
The index's blind spots are inherited from pair counting. It weights every pair equally, so it is dominated by the largest clusters; it says nothing about which clusters correspond; and with very many small clusters its chance model can behave oddly. Pair it with a contingency table, or with the variation of information, when the structure of the disagreement matters.
Where the aggregates come from
From a contingency table with cell counts n_ij, the together-in-both count is the sum over cells of n_ij choose 2; the together-counts for each clustering are the same sum over its row and column totals. Any clustering library that reports a contingency table can produce the three inputs in seconds.
If you have the full table, the direct ARI functions in those libraries do the same arithmetic. This calculator is for the common situation where a paper, a report or a colleague gives you the pair counts - or where you want to see the chance correction's moving parts rather than trust a black box.
The expected-agreement secondary is the number that explains why the adjustment matters. In the first example, two clusterings of 100 items would already agree on 581.82 pairs by chance alone given their cluster sizes, so the raw Rand index of 0.7980 flatters the match; the adjusted value of 0.5528 is what remains after that free agreement is charged against the total. The third example shows the same correction at a higher level: a Rand index of 0.9196 adjusts to 0.8091, because with 5,200 pairs together in both clusterings out of much larger pair counts, the chance baseline of 1,808.54 is big enough to matter even there. Always report the adjusted figure; the raw one is a ceiling, not a score.
A practical note on scale closes the topic: the index is computed from pair counts, so its cost grows with the square of the item count, and the first example's 100 items already generate thousands of pairs while the third example's 200 items generate tens of thousands. For very large clusterings the counts are accumulated from the contingency table rather than by enumerating pairs, which is algebraically identical and vastly cheaper - but it means the four inputs this calculator takes are exactly the aggregates that table produces, and they should be lifted from it rather than estimated.
FAQs
What adjusted Rand index does the first example give?
The first example gives an ARI of 0.5528. Its 1,200 together-pairs exceed the 581.82 expected by chance by about 55% of the maximum possible excess over chance.
What raw Rand index does the first example give?
The raw Rand index is 0.7980 in the first example - 1,200 together-pairs plus 2,750 apart-pairs over 4,950 total pairs. The adjustment discounts the large share of that agreement chance alone would deliver.
How many together-pairs would chance produce in the first example?
Chance would produce 581.82 together-pairs: the two together-counts of 1,800 and 1,600 multiplied, divided by the 4,950 total pairs.
What ARI does the compact second example give?
The compact second example gives 0.6292, adjusted down from a raw Rand index of 0.8367 - the chance correction is proportionally larger on smaller, coarser partitions.
What ARI does the large third example give?
The large third example gives 0.8091. Even with 5,200 together-pairs, chance accounts for 1,808.54 of them, so the adjusted value sits well below the raw 0.9196.
How many pairs are in different clusters in both, example one?
In the first example 2,750 pairs are in different clusters in both clusterings. Together with the 1,200 together-pairs, they make up the agreeing pairs behind the raw Rand index.