You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mayer79 hm the distribution makes sense, I hadn't thought about that in my quick hack. But that should be possible with the more low-level method, right? _partial_dependence_brute has grid. Or are there other differences?
Parameter grid will solve the problem. Unfortunately, the computational burden is tremendous because the original H-statistic uses all rows as grid (one column for the one-dimensional PDP, two columns for the two-dimensional one). The next bullet points explain two usual tricks to reduce the burden to a realistic level.
Subsampling: Use only a sample of size m = 200 (or so) from all rows as grid. m should not be too small because we are representing a two-dimensional empirical distribution.
Weighting: If there are many discrete variables, the grids can be compressed to distinct rows and then use weighted PDP.
So far, you have calculated H-squared, which I actually find easier to interpret as the original H.
@Simar-B because our partial dependence is a bit weird about the mean and it shouldn't be included.
@mayer79 We can use the usual PDP trick for tree-based models, right? That seems more tricky, though, as we have to think about how to include the weighting. But as Hutter did it for functional anova, I think we should be able to do it here. @NicolasHug might have thoughts? Having just a slow implementation to start might still be useful, though, or maybe have some "reasonable" subsampling?
@fractionalhare It is usually best practice to open a PR even if the implementation is only work in progress. This way, it is visible that you are working on it, and you might even get some early review comments preventing work in wrong directions (depending on reviewer capacity, of course).
Activity
amueller commentedon Feb 5, 2022
Something like this?
having the means in the partial dependence plot makes it a bit weird but I think this should be about it?
niranjanorkat commentedon Feb 6, 2022
@amueller I'm adding the pull request for this feature
lorentzenchr commentedon Feb 13, 2022
I‘d be in favor of having it in scikit-learn, not just as example. It would be wonderful in combination with #15263.
mayer79 commentedon Feb 13, 2022
Good idea!
Note: The partial dependence values are to be calculated not on a grid but rather on a random sample from the empirical distribution.
mayer79 commentedon Feb 13, 2022
IMHO, the model agnostic reference implementation is in Christoph Molnar's iml package in R https://github.com/christophM/iml/blob/main/R/Interaction.R
It is not trivial to correctly calculate the H statistic, but a cool thing to have.
amueller commentedon Feb 28, 2022
@mayer79 hm the distribution makes sense, I hadn't thought about that in my quick hack. But that should be possible with the more low-level method, right?
_partial_dependence_brutehasgrid. Or are there other differences?mayer79 commentedon Mar 1, 2022
@amueller :
gridwill solve the problem. Unfortunately, the computational burden is tremendous because the original H-statistic uses all rows as grid (one column for the one-dimensional PDP, two columns for the two-dimensional one). The next bullet points explain two usual tricks to reduce the burden to a realistic level.Simar-B commentedon Mar 23, 2022
@amueller Why did you add and subtract
diabetes.target.mean()mean in the numerator and denominator respectively for the h statisticamueller commentedon Mar 29, 2022
@Simar-B because our partial dependence is a bit weird about the mean and it shouldn't be included.
@mayer79 We can use the usual PDP trick for tree-based models, right? That seems more tricky, though, as we have to think about how to include the weighting. But as Hutter did it for functional anova, I think we should be able to do it here. @NicolasHug might have thoughts? Having just a slow implementation to start might still be useful, though, or maybe have some "reasonable" subsampling?
fractionalhare commentedon Jul 18, 2022
/take
fractionalhare commentedon Jul 18, 2022
I actually have a fully working implementation of this now, so I can open a PR soon. I am designing and implementing tests for it.
lorentzenchr commentedon Aug 12, 2022
@fractionalhare It is usually best practice to open a PR even if the implementation is only work in progress. This way, it is visible that you are working on it, and you might even get some early review comments preventing work in wrong directions (depending on reviewer capacity, of course).
conorosully commentedon Nov 17, 2023
@fractionalhare Was this feature added in the end? I think it would be very useful.
mayer79 commentedon Nov 17, 2023
@conorosully: Not an answer to your question, just two comments: