Skip to content
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

Merged
merged 3 commits into from Sep 14, 2021

Conversation

glemaitre
Copy link
Member

closes #21027

Use estimator_name instead of name as an attribute in the display for CalibrationDisplay

ping @thomasjpfan

Copy link
Member

@thomasjpfan thomasjpfan left a 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.

sklearn/calibration.py Outdated Show resolved Hide resolved
@thomasjpfan thomasjpfan added this to the 1.0 milestone Sep 13, 2021
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick:

Suggested change
Name of estimator. If None, the estimator name is not shown.
Name of estimator. If `None`, the estimator name is not shown.

Copy link
Member

@lucyleeow lucyleeow Sep 14, 2021

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
Copy link
Member

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.

Comment on lines 1044 to 1045
Name for labeling curve. If `None`, the name of the estimator
is used.
Copy link
Member

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...?

Copy link
Member Author

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.

@adrinjalali
Copy link
Member

tagging #20965

@adrinjalali adrinjalali merged commit d21847c into scikit-learn:main Sep 14, 2021
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Sep 14, 2021
…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>
adrinjalali pushed a commit that referenced this pull request Sep 14, 2021
* 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>
samronsin pushed a commit to samronsin/scikit-learn that referenced this pull request Nov 30, 2021
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistence between CalibrationDisplay and over Display
4 participants