-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
FIX solved legend issue in PDP #18713
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
Conversation
label = None if self.kind == "average" else "average" | ||
# do not modify the `line_kw` in place since it might be reuse for | ||
# each feature for which the partial dependence is requested | ||
line_kw = deepcopy(line_kw) |
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.
Do you think this is cleaner:
default_line_kw = {'label': None if self.kind == "average" else "average"}
line_kw = {**default_line_kw, **line_kw}
And then update the signature of _plot_average_dependence
to only accept line_kw
.
This would lower the number of arguments for _plot_average_dependence
as well.
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.
Sounds like a good suggestion.
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.
Nice
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.
Once @thomasjpfan suggestion has been taken into account, +1 for merging the part on PDP.
For the part on the calibrators, maybe we could introduce a property with a deprecation warning to provide some backward compat.
@@ -141,7 +141,7 @@ class of an instance (red: class 1, green: class 2, blue: class 3). | |||
calibrated_classifier = sig_clf.calibrated_classifiers_[0] | |||
prediction = np.vstack([calibrator.predict(this_p) | |||
for calibrator, this_p in | |||
zip(calibrated_classifier.calibrators_, p.T)]).T | |||
zip(calibrated_classifier.calibrators, p.T)]).T |
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.
hum.. that's bad because we changed something that could be argue to be part of the public API since 0.23. We took care of it for calibrated_classifiers_
but not for this nested attribute...
@glemaitre would you mind splitting this PR in two to merge them independently?
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.
But even if we add the backward compat we should indeed also update the example to avoid triggering the FutureWarning
.
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 will do that.
OK We should be OK now for the PDP part. |
I will open a new issue for the calibration |
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.
LGTM
Thanks @glemaitre. |
Fixing master
closes #18712
I am not sure why we did not catch these errors before merging:
PDP:
label
could not be overwritten en plotting the PDPCalibratedClassifierCV
This will be addressed in a separate pull-request