Skip to content

Commit 36edbff

Browse files
authored
DOC Ensures that adjusted_rand_score passes numpydoc validation (#24345)
1 parent d1681ce commit 36edbff

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

sklearn/metrics/cluster/_supervised.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,35 @@ def adjusted_rand_score(labels_true, labels_pred):
335335
Parameters
336336
----------
337337
labels_true : int array, shape = [n_samples]
338-
Ground truth class labels to be used as a reference
338+
Ground truth class labels to be used as a reference.
339339
340340
labels_pred : array-like of shape (n_samples,)
341-
Cluster labels to evaluate
341+
Cluster labels to evaluate.
342342
343343
Returns
344344
-------
345345
ARI : float
346346
Similarity score between -0.5 and 1.0. Random labelings have an ARI
347347
close to 0.0. 1.0 stands for perfect match.
348348
349+
See Also
350+
--------
351+
adjusted_mutual_info_score : Adjusted Mutual Information.
352+
353+
References
354+
----------
355+
.. [Hubert1985] L. Hubert and P. Arabie, Comparing Partitions,
356+
Journal of Classification 1985
357+
https://link.springer.com/article/10.1007%2FBF01908075
358+
359+
.. [Steinley2004] D. Steinley, Properties of the Hubert-Arabie
360+
adjusted Rand index, Psychological Methods 2004
361+
362+
.. [wk] https://en.wikipedia.org/wiki/Rand_index#Adjusted_Rand_index
363+
364+
.. [Chacon] :doi:`Minimum adjusted Rand index for two clusterings of a given size,
365+
2022, J. E. Chacón and A. I. Rastrojo <10.1007/s11634-022-00491-w>`
366+
349367
Examples
350368
--------
351369
Perfectly matching labelings have a score of 1 even
@@ -379,25 +397,6 @@ def adjusted_rand_score(labels_true, labels_pred):
379397
380398
>>> adjusted_rand_score([0, 0, 1, 1], [0, 1, 0, 1])
381399
-0.5
382-
383-
References
384-
----------
385-
.. [Hubert1985] L. Hubert and P. Arabie, Comparing Partitions,
386-
Journal of Classification 1985
387-
https://link.springer.com/article/10.1007%2FBF01908075
388-
389-
.. [Steinley2004] D. Steinley, Properties of the Hubert-Arabie
390-
adjusted Rand index, Psychological Methods 2004
391-
392-
.. [wk] https://en.wikipedia.org/wiki/Rand_index#Adjusted_Rand_index
393-
394-
.. [Chacon] :doi:`Minimum adjusted Rand index for two clusterings of a given size,
395-
2022, J. E. Chacón and A. I. Rastrojo <10.1007/s11634-022-00491-w>`
396-
397-
398-
See Also
399-
--------
400-
adjusted_mutual_info_score : Adjusted Mutual Information.
401400
"""
402401
(tn, fp), (fn, tp) = pair_confusion_matrix(labels_true, labels_pred)
403402
# convert to Python integer types, to avoid overflow or underflow

sklearn/tests/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"sklearn.metrics._ranking.roc_curve",
2222
"sklearn.metrics.cluster._bicluster.consensus_score",
2323
"sklearn.metrics.cluster._supervised.adjusted_mutual_info_score",
24-
"sklearn.metrics.cluster._supervised.adjusted_rand_score",
2524
"sklearn.metrics.cluster._supervised.entropy",
2625
"sklearn.metrics.cluster._supervised.fowlkes_mallows_score",
2726
"sklearn.metrics.pairwise.pairwise_distances_chunked",

0 commit comments

Comments
 (0)