From bcdbf7d30399c3ba4a470d63084fabc585744922 Mon Sep 17 00:00:00 2001 From: Mitzi <46392144+embandera@users.noreply.github.com> Date: Sun, 7 Nov 2021 00:51:33 -0700 Subject: [PATCH] DOC Ensures that balanced_accuracy_score passes numpydoc validation (#21478) --- maint_tools/test_docstrings.py | 1 - sklearn/metrics/_classification.py | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index 0866da1e54bfe..397976b11d998 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -86,7 +86,6 @@ "sklearn.linear_model._ridge.ridge_regression", "sklearn.manifold._locally_linear.locally_linear_embedding", "sklearn.manifold._t_sne.trustworthiness", - "sklearn.metrics._classification.balanced_accuracy_score", "sklearn.metrics._classification.brier_score_loss", "sklearn.metrics._classification.classification_report", "sklearn.metrics._classification.cohen_kappa_score", diff --git a/sklearn/metrics/_classification.py b/sklearn/metrics/_classification.py index 8f182497bbb1d..ac726dd816a13 100644 --- a/sklearn/metrics/_classification.py +++ b/sklearn/metrics/_classification.py @@ -1943,10 +1943,16 @@ def balanced_accuracy_score(y_true, y_pred, *, sample_weight=None, adjusted=Fals Returns ------- balanced_accuracy : float + Balanced accuracy score. See Also -------- - recall_score, roc_auc_score + average_precision_score : Compute average precision (AP) from prediction + scores. + precision_score : Compute the precision score. + recall_score : Compute the recall score. + roc_auc_score : Compute Area Under the Receiver Operating Characteristic + Curve (ROC AUC) from prediction scores. Notes ----- @@ -1973,7 +1979,6 @@ def balanced_accuracy_score(y_true, y_pred, *, sample_weight=None, adjusted=Fals >>> y_pred = [0, 1, 0, 0, 0, 1] >>> balanced_accuracy_score(y_true, y_pred) 0.625 - """ C = confusion_matrix(y_true, y_pred, sample_weight=sample_weight) with np.errstate(divide="ignore", invalid="ignore"):