AdjustedRandIndex<T>
Models & Types · AiDotNet.Clustering.Evaluation
Adjusted Rand Index for comparing cluster assignments.
Implements: IExternalClusterMetric<T>
For Beginners
ARI measures how well clusterings agree.
Consider all pairs of points:
- True Positive: Same cluster in both
- True Negative: Different clusters in both
- Pairs that disagree: One says same, other says different
Rand Index = (TP + TN) / (all pairs) But random clusterings can have high RI by chance!
Adjusted Rand Index corrects for this:
- ARI = 1: Perfect match
- ARI = 0: No better than random
- ARI < 0: Worse than random (rare)
How It Works
The Adjusted Rand Index (ARI) measures agreement between two clusterings, adjusted for chance. Values range from -1 to 1:
- 1: Perfect agreement
- 0: Random labeling (expected by chance)
- Negative: Less agreement than random
ARI = (RI - Expected_RI) / (max(RI) - Expected_RI) Where RI is the Rand Index (fraction of pairs that agree).
Constructors
| Constructor | Summary |
|---|---|
AdjustedRandIndex() |
Initializes a new AdjustedRandIndex instance. |
Methods
| Method | Summary |
|---|---|
double Compute(Vector<T> trueLabels, Vector<T> predictedLabels) |