-
-
Notifications
You must be signed in to change notification settings - Fork 26k
DOC Fix pos_label
docstring in Display classes
#31696
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
base: main
Are you sure you want to change the base?
Conversation
sklearn/metrics/_plot/roc_curve.py
Outdated
@@ -72,8 +72,7 @@ class RocCurveDisplay(_BinaryClassifierCurveDisplayMixin): | |||
pos_label : int, float, bool or str, default=None | |||
The class considered as the positive class when computing the roc auc | |||
metrics. By default, `estimators.classes_[1]` is considered | |||
as the positive class. | |||
metrics. Used for labelling the axes. If `None`, not included in labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit confused by the wording until I ran some experiments in Jupyter. 😅
What do you think about:
metrics. Used for labelling the axes. If `None`, not included in labels. | |
metrics. If not `None`, this value is displayed in the x- and y-axis labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is MUCH better. I didn't like what I had but I couldn't think of how to improve. Let me update other docstrings to say something along these lines too, as it would be nice to know what pos_label
is actually doing - just updating figure labels!
pos_label
docstring in RocCurveDisplay
pos_label
docstring in Display classes
@@ -1103,6 +1103,7 @@ class CalibrationDisplay(_BinaryClassifierCurveDisplayMixin): | |||
pos_label : int, float, bool or str, default=None | |||
The positive class when computing the calibration curve. | |||
If not `None`, this value is displayed in the x- and y-axes labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put that right after the next sentence. Explaining what's the default behavior feels like a higher priority to me.
metrics. By default, `estimators.classes_[1]` is considered | ||
as the positive class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be something like
By default, `pos_label` is set to `estimators.classes_[1]` when using
`from_estimator` and set to 1 when using `from_predictions`.
@@ -72,8 +72,7 @@ class RocCurveDisplay(_BinaryClassifierCurveDisplayMixin): | |||
pos_label : int, float, bool or str, default=None | |||
The class considered as the positive class when computing the roc auc | |||
metrics. By default, `estimators.classes_[1]` is considered | |||
as the positive class. | |||
metrics. If not `None`, this value is displayed in the x- and y-axes labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add it to the docstrings of from_estimator
and from_predictions
as well ? They're likely be more seen than the class docstring.
Reference Issues/PRs
Noticed when working on #28972
Specify that
pos_label
from init is used to label the x and y axes. Fixes some inaccuracies:pos_label
parameter in display class init is not able to be inferpos_label
(as it does not have access to estimator or predictions).Fix docstrings accordingly.
What does this implement/fix? Explain your changes.
Any other comments?