-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
FIX: Only over-write specified default kwargs in Displays #32313
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: Only over-write specified default kwargs in Displays #32313
Conversation
|
@jeremiedbb I've amended such that Thank you! 🙏 |
|
Let me have a look at this one. |
sklearn/utils/_plotting.py
Outdated
| # This should never happen, as we would not pass the same keys to both | ||
| # default kwargs | ||
| common_keys = set(default_curve_kwargs).intersection(default_multi_curve_kwargs) | ||
| if len(common_keys) > 0: | ||
| raise ValueError( | ||
| "`default_curve_kwargs` and `default_multi_curve_kwargs` both contain " | ||
| f"the keys {common_keys}. The same kwargs cannot be passed to both " | ||
| "defaults." | ||
| ) |
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 don't think that passing the same keys should be a problem. I can imagine a case where you have a slightly different default for multi curves. To me the default_multi_curve_kwargs would just override the default_kurve_kwargs. What do you think ?
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.
Yes I agree. I was being too defensive and didn't think that this is an internal function and will not be used by users. I've amended the functionality.
|
Looks like there is an upstream service disruption to circle CI (https://status.circleci.com/), which is why the jobs are failing, so I think we can ignore for the reviews. cc @jeremiedbb |
glemaitre
left a comment
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 look good on my side. Thanks @lucyleeow
|
Gentle ping @jeremiedbb , thank you |
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.
Thanks @lucyleeow, LGTM as well.
Reference Issues/PRs
#30508
Separated out from #30508
What does this implement/fix? Explain your changes.
As discussed in https://github.com/scikit-learn/scikit-learn/pull/30508/files#r2154473997:
Previously, if you passed any curve_kwargs, it would over-ride all default kwargs.
Now, if an individual curve_kwargs that changes the same parameter as a default kwarg is passed, only that parameter will be over-ridden. All other default kwargs will still be used. E.g., if the user set color to red in curve_kwargs, only the defualt color parameter will be over-ridden. The other parameters (e.g., "alpha": 0.5, "linestyle": "--") will still be used.
I think it is more likely that if a user e.g., sets the curve color to be red, they still want the other default kwargs (i.e., they only want to change the color).
Any other comments?
cc @jeremiedbb @glemaitre