8000 FIX potentially redundant marker argument by ArturoAmorQ · Pull Request #27043 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

FIX potentially redundant marker argument #27043

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

Merged
merged 4 commits into from
Aug 9, 2023

Conversation

ArturoAmorQ
Copy link
Member

Reference Issues/PRs

What does this implement/fix? Explain your changes.

The Comparison of Calibration of Classifiers example is raising a

UserWarning:

marker is redundantly defined by the 'marker' keyword argument and the fmt string "s-" (-> marker='s'). The keyword argument will take precedence.

As users may want to customize the marker as done in this example, this PR uses the setdefault method to check if 'marker' is already a key in line_kwargs. If it's not present, it adds the key with the value 's'. If it's already present, it does nothing, avoiding the redundancy.

Any other comments?

@github-actions
Copy link
github-actions bot commented Aug 9, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 56aa76c. Link to the linter CI: here

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.

Thank you for the PR!

@@ -1190,12 +1190,13 @@ def plot(self, *, ax=None, name=None, ref_line=True, **kwargs):
if name is not None:
line_kwargs["label"] = name
line_kwargs.update(**kwargs)
line_kwargs.setdefault("marker", "s")
Copy link
Member

Choose a reason for hiding this comment

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

Can the default value be placed during the initiation of line_kwargs?

line_kwargs = {"marker": "s"}

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right! And that's probably cleaner 😅.
I addressed your comment in my latest commit.

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
ArturoAmorQ and others added 2 commits August 9, 2023 17:42
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
@thomasjpfan thomasjpfan added Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one! labels Aug 9, 2023
Copy link
Contributor
@Micky774 Micky774 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@Micky774 Micky774 merged commit 438b919 into scikit-learn:main Aug 9, 2023
TamaraAtanasoska pushed a commit to TamaraAtanasoska/scikit-learn that referenced this pull request Aug 21, 2023
Co-authored-by: ArturoAmorQ <arturo.amor-quiroz@polytechnique.edu>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
@ArturoAmorQ ArturoAmorQ deleted the calibration_display branch August 24, 2023 09:18
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 18, 2023
Co-authored-by: ArturoAmorQ <arturo.amor-quiroz@polytechnique.edu>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
jeremiedbb pushed a commit that referenced this pull request Sep 20, 2023
Co-authored-by: ArturoAmorQ <arturo.amor-quiroz@polytechnique.edu>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
Co-authored-by: ArturoAmorQ <arturo.amor-quiroz@polytechnique.edu>
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
Labels
Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0