-
-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
[MRG] BUG Fixes partial dependence bug by setting axes to be invisible #15572
[MRG] BUG Fixes partial dependence bug by setting axes to be invisible #15572
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.
I'm fine with the changes but I don't understand what test_plot_partial_dependence_with_same_axes
is supposed to explain
Why aren't we allowed to use the same ax
object?
The expected behavior of using the same axes, is to draw on axes created by the first call. The following example will fail: tree_disp = plot_partial_dependence(mlp, X, ["LSTAT", "RM"], ax=ax)
# will error
mlp_disp = plot_partial_dependence(mlp, X, ["LSTAT", "RM"], ax=ax) This is because Currently our api allows: tree_disp = plot_partial_dependence(mlp, X, ["LSTAT", "RM"], ax=ax)
# will not raise
mlp_disp = plot_partial_dependence(mlp, X, ["LSTAT", "RM"], ax=tree_disp.axes_) Because the second call gets the axes directly and uses them to plot the new curves. |
Thanks. Would be great if test_plot_partial_dependence_with_same_axes explained this (more succinctly) |
Added more details in explaining |
Are you sure that you added something? I don't see any push since your comment? |
Oops forgot to push |
LGTM now :) Thanks @thomasjpfan |
I just talked with @tacaswell and he suggested removing the axes from the figure instead of hiding it. |
Initially, I resized the original axes to the size of one of the plots but it was really janky with constraints. I am happy with removing the original axes. |
@thomasjpfan the other solution which was suggested was reshaping the axis to be the first axis of the stolen space. But maybe doing the removal for now would be ok? |
Reference Issues/PRs
Fixes bug with the title not displaying in
examples/plot_partial_dependence_visualization_api.py
Instead of making the axes not visible, this checks if the axes is off to see if the axes was used twice.
What does this implement/fix? Explain your changes.
To see why this check was needed, please look at
test_plot_partial_dependence_with_same_axes
.Any other comments?
CC @NicolasHug @amueller @glemaitre