From fcf1119b07f4a0f7be4b65ceef75aee9fa2caf91 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Sat, 16 Jul 2022 10:33:08 +0100 Subject: [PATCH 1/3] DOC: Update sklearn.metrics._classification.jaccard_score to pass numpydoc validation. --- sklearn/metrics/_classification.py | 6 +++++- sklearn/tests/test_docstrings.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sklearn/metrics/_classification.py b/sklearn/metrics/_classification.py index b45c09679e805..5d000af2be9f7 100644 --- a/sklearn/metrics/_classification.py +++ b/sklearn/metrics/_classification.py @@ -740,10 +740,14 @@ def jaccard_score( ------- score : float (if average is not None) or array of floats, shape =\ [n_unique_labels] + The Jaccard score. See Also -------- - accuracy_score, f1_score, multilabel_confusion_matrix + accuracy_score : Function for calculating the accuracy score. + f1_score : Function for calculating the F1 score. + multilabel_confusion_matrix : Function for computing a confusion matrix\ + for each class or sample. Notes ----- diff --git a/sklearn/tests/test_docstrings.py b/sklearn/tests/test_docstrings.py index 1489dd5c6da72..e406151219a23 100644 --- a/sklearn/tests/test_docstrings.py +++ b/sklearn/tests/test_docstrings.py @@ -33,7 +33,6 @@ "sklearn.manifold._t_sne.trustworthiness", "sklearn.metrics._classification.brier_score_loss", "sklearn.metrics._classification.cohen_kappa_score", - "sklearn.metrics._classification.jaccard_score", "sklearn.metrics._plot.det_curve.plot_det_curve", "sklearn.metrics._plot.precision_recall_curve.plot_precision_recall_curve", "sklearn.metrics._ranking.coverage_error", From fc3fcc55f6202e17fe06f322f83cc4410fbe13ad Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Sat, 16 Jul 2022 17:53:54 +0100 Subject: [PATCH 2/3] DOC Incorporate suggested changes to return type Co-authored-by: Guillaume Lemaitre --- sklearn/metrics/_classification.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sklearn/metrics/_classification.py b/sklearn/metrics/_classification.py index 5d000af2be9f7..77fcbd2a4a719 100644 --- a/sklearn/metrics/_classification.py +++ b/sklearn/metrics/_classification.py @@ -738,8 +738,7 @@ def jaccard_score( Returns ------- - score : float (if average is not None) or array of floats, shape =\ - [n_unique_labels] + score : float or ndarray of shape (n_unique_labels,), dtype=np.float64 The Jaccard score. See Also From 11048f00ee59f08e9a0cbb2c0c4d66b72c9d5fa1 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Sat, 16 Jul 2022 17:54:20 +0100 Subject: [PATCH 3/3] DOC Incorporate suggested changes to return description. Co-authored-by: Guillaume Lemaitre --- sklearn/metrics/_classification.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sklearn/metrics/_classification.py b/sklearn/metrics/_classification.py index 77fcbd2a4a719..326df514986fb 100644 --- a/sklearn/metrics/_classification.py +++ b/sklearn/metrics/_classification.py @@ -739,7 +739,8 @@ def jaccard_score( Returns ------- score : float or ndarray of shape (n_unique_labels,), dtype=np.float64 - The Jaccard score. + The Jaccard score. When `average` is not `None`, a single scalar is + returned. See Also --------