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
RFC refactoring of PartialDependenceDisplay #25079
Comments
Can you please update the description of the issue to give more details on the proposed new API on the same example as the one above with I am not sure I understand the proposal. Is the goal to make Would you suggest introducing another class for dedicated for 2-way PD plots and reserve the
I agree. |
Yes, this is exactly my proposal.
I think this is fine to have a single class. |
Thanks @glemaitre. I remember thinking the PDP code-based was fairly complex and simplifying it would be a worthwhile investment. I think a lot of the complexity comes from the fact that its design pre-dates our Display API. So any decision that was made back then is worth re-visiting.
Did you mean Regarding |
The only caveat I'd note about a deprecation is that the PDPs utilities have gone through at least 2 major deprecation cycles in the past years: in 0.21 we moved them from |
I would like to discuss the possibility to refactor
PartialDependenceDisplay
to reduce its usability. The idea behind this refactoring is:PartialDependenceDisplay
is equivalent to a call topartial_dependence
.matplotlib
: it allows a user that knowsmatplotlib
to quickly modify and tune the figure without knowing some implementation details enforced byscikit-learn
.Sharing y-axis
One main reason for having
PartialDependenceDisplay
doing several plots is mainly for setting a common y-axis. However,matplotlib
allows such a feature when creating a figure:Here, the call could be done with
PartialDependenceDisplay
instead of the call topartial_dependence
+ plotting.In this case, a user can still manipulate the difference axes using
axs
and make any usual matplotlib.Surprising API
With the current
PartialDependenceDisplay
, we will have some parameters specific to our settings:ncols
to set the number of columns and fitted attributebounding_axis_
andaxes_
. The latest attributes are required if someone is giving an axis, for instance, to provide a certain figure size:I personally find it more intuitive to have
ax
containing all the axes without picking up in the scikit-learn documentation, which way the plot is organized.Cons
The only thing that could be more difficult is to plot 1D and 2D PD at the same time. Since one wants to share y-axis for 1D plot, this is indeed not a desired feature to have for the 2D PD. Therefore, it requires our user to know how to share y-axis only for some of the axis.
At the same time, it could be argued that having a mixed type of 1D and 2D plots on the same figure should not be a feature :) Those should be on separate figures.
Proposed API
The new API would force the user to materialize a
for
loop to handle each individual plot as:The text was updated successfully, but these errors were encountered: