adjusted_rand_index#
- adjusted_rand_index(y_true: ArrayLike, y_pred: ArrayLike) float[source][source]#
Compute the adjusted Rand index for two segmentations.
Similar to Rand index but adjusted for chance. Wraps
sklearn.metrics.adjusted_rand_score.- Parameters:
- y_truearray-like of shape (n_samples,)
True segment labels, as returned by
predict().- y_predarray-like of shape (n_samples,)
Predicted segment labels, as returned by
predict().
- Returns:
- float
Adjusted Rand index in [-1, 1]. Higher is better. 1.0 = perfect agreement, ~0.0 = random labeling.
Examples
>>> adjusted_rand_index([0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1]) 1.0