Skip to content

DOC Ensures that pair_confusion_matrix passes numpydoc validation #24094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions sklearn/metrics/cluster/_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def contingency_matrix(


def pair_confusion_matrix(labels_true, labels_pred):
"""Pair confusion matrix arising from two clusterings.
"""Pair confusion matrix arising from two clusterings [1]_.

The pair confusion matrix :math:`C` computes a 2 by 2 similarity matrix
between two clusterings by considering all pairs of samples and counting
Expand Down Expand Up @@ -188,9 +188,15 @@ def pair_confusion_matrix(labels_true, labels_pred):

See Also
--------
rand_score: Rand Score
adjusted_rand_score: Adjusted Rand Score
adjusted_mutual_info_score: Adjusted Mutual Information
rand_score: Rand Score.
adjusted_rand_score: Adjusted Rand Score.
adjusted_mutual_info_score: Adjusted Mutual Information.

References
----------
.. [1] :doi:`Hubert, L., Arabie, P. "Comparing partitions."
Journal of Classification 2, 193–218 (1985).
<10.1007/BF01908075>`

Examples
--------
Expand All @@ -211,12 +217,6 @@ def pair_confusion_matrix(labels_true, labels_pred):
[0, 2]]...

Note that the matrix is not symmetric.

References
----------
.. L. Hubert and P. Arabie, Comparing Partitions, Journal of
Classification 1985
https://link.springer.com/article/10.1007%2FBF01908075
"""
labels_true, labels_pred = check_clusterings(labels_true, labels_pred)
n_samples = np.int64(labels_true.shape[0])
Expand Down
1 change: 0 additions & 1 deletion sklearn/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"sklearn.metrics.cluster._supervised.adjusted_rand_score",
"sklearn.metrics.cluster._supervised.entropy",
"sklearn.metrics.cluster._supervised.fowlkes_mallows_score",
"sklearn.metrics.cluster._supervised.pair_confusion_matrix",
"sklearn.metrics.cluster._supervised.rand_score",
"sklearn.metrics.cluster._supervised.v_measure_score",
"sklearn.metrics.pairwise.pairwise_distances_chunked",
Expand Down