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
FIX use same API for CalibrationDisplay than other Display #21031
Conversation
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.
Looks good. Small comment on the default name.
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
name : str, default=None | ||
Name for labeling curve. | ||
estimator_name : str, default=None | ||
Name of estimator. If None, the estimator name is not shown. |
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.
nitpick:
Name of estimator. If None, the estimator name is not shown. | |
Name of estimator. If `None`, the estimator name is not shown. |
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.
To be pedantic there is no label shown in the plot only if self.estimator
is None
and in the plot
method name
is also None
...?
@@ -1061,8 +1062,7 @@ def plot(self, *, ax=None, name=None, ref_line=True, **kwargs): | |||
if ax is None: | |||
fig, ax = plt.subplots() | |||
|
|||
name = self.name if name is None else name | |||
self.name = name |
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.
Agree that this is weird, maybe it's left over from a previous iteration/API and I forgot to change.
sklearn/calibration.py
Outdated
Name for labeling curve. If `None`, the name of the estimator | ||
is used. |
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 only true if from_estimator
is used. If from_predictions
is used the default is 'Classifier' (with @thomasjpfan's new suggestion). But since this is not public facing API, maybe we can just say if None
a 'default' value is used...?
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.
It is even different. If name
is None
, then we use estimator_name
and if it is also None
then we don't show anything.
tagging #20965 |
…arn#21031) * FIX use same API for CalibrationDisplay than other Display * Update sklearn/calibration.py Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> * iter Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
* FIX use same API for CalibrationDisplay than other Display * Update sklearn/calibration.py Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> * iter Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
…arn#21031) * FIX use same API for CalibrationDisplay than other Display * Update sklearn/calibration.py Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> * iter Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
closes #21027
Use
estimator_name
instead ofname
as an attribute in the display forCalibrationDisplay
ping @thomasjpfan