Skip to content

Commit a64b6b2

Browse files
authored
DOC Fix pos_label docstring in Display classes (scikit-learn#31696)
1 parent a048a40 commit a64b6b2

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

sklearn/calibration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,9 +1102,8 @@ class CalibrationDisplay(_BinaryClassifierCurveDisplayMixin):
11021102
Name of estimator. If None, the estimator name is not shown.
11031103
11041104
pos_label : int, float, bool or str, default=None
1105-
The positive class when computing the calibration curve.
1106-
By default, `pos_label` is set to `estimators.classes_[1]` when using
1107-
`from_estimator` and set to 1 when using `from_predictions`.
1105+
The positive class when calibration curve computed.
1106+
If not `None`, this value is displayed in the x- and y-axes labels.
11081107
11091108
.. versionadded:: 1.1
11101109
@@ -1385,7 +1384,8 @@ def from_predictions(
13851384
13861385
pos_label : int, float, bool or str, default=None
13871386
The positive class when computing the calibration curve.
1388-
By default `pos_label` is set to 1.
1387+
When `pos_label=None`, if `y_true` is in {-1, 1} or {0, 1},
1388+
`pos_label` is set to 1, otherwise an error will be raised.
13891389
13901390
.. versionadded:: 1.1
13911391

sklearn/metrics/_plot/det_curve.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class DetCurveDisplay(_BinaryClassifierCurveDisplayMixin):
3434
Name of estimator. If None, the estimator name is not shown.
3535
3636
pos_label : int, float, bool or str, default=None
37-
The label of the positive class.
37+
The label of the positive class. If not `None`, this value is displayed in
38+
the x- and y-axes labels.
3839
3940
Attributes
4041
----------
@@ -136,9 +137,8 @@ def from_estimator(
136137
exist :term:`decision_function` is tried next.
137138
138139
pos_label : int, float, bool or str, default=None
139-
The label of the positive class. When `pos_label=None`, if `y_true`
140-
is in {-1, 1} or {0, 1}, `pos_label` is set to 1, otherwise an
141-
error will be raised.
140+
The label of the positive class. By default, `estimators.classes_[1]`
141+
is considered as the positive class.
142142
143143
name : str, default=None
144144
Name of DET curve for labeling. If `None`, use the name of the

sklearn/metrics/_plot/precision_recall_curve.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class PrecisionRecallDisplay(_BinaryClassifierCurveDisplayMixin):
4040
Name of estimator. If None, then the estimator name is not shown.
4141
4242
pos_label : int, float, bool or str, default=None
43-
The class considered as the positive class. If None, the class will not
44-
be shown in the legend.
43+
The class considered the positive class when precision and recall metrics
44+
computed. If not `None`, this value is displayed in the x- and y-axes labels.
4545
4646
.. versionadded:: 0.24
4747
@@ -449,7 +449,9 @@ def from_predictions(
449449
450450
pos_label : int, float, bool or str, default=None
451451
The class considered as the positive class when computing the
452-
precision and recall metrics.
452+
precision and recall metrics. When `pos_label=None`, if `y_true` is
453+
in {-1, 1} or {0, 1}, `pos_label` is set to 1, otherwise an error
454+
will be raised.
453455
454456
name : str, default=None
455457
Name for labeling curve. If `None`, name will be set to

sklearn/metrics/_plot/roc_curve.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ class RocCurveDisplay(_BinaryClassifierCurveDisplayMixin):
7171
.. versionadded:: 1.7
7272
7373
pos_label : int, float, bool or str, default=None
74-
The class considered as the positive class when computing the roc auc
75-
metrics. By default, `estimators.classes_[1]` is considered
76-
as the positive class.
74+
The class considered the positive class when ROC AUC metrics computed.
75+
If not `None`, this value is displayed in the x- and y-axes labels.
7776
7877
.. versionadded:: 0.24
7978

0 commit comments

Comments
 (0)