ENH Support sample weights in PartialDependenceDisplay.from_estimator - #26644
Conversation
✔️ Linting PassedAll linting checks passed. Your pull request is in excellent shape! ☀️ Generated for commit: 956002d |
|
Kindly pinging @glemaitre, @lorentzenchr, @jeremiedbb here as you might be interested and already familiar with the previous PR. I wasn't creative in the test, as it was unclear to me what we want to evaluate. Therefore, any suggestions are welcome! |
glemaitre
left a comment
There was a problem hiding this comment.
It looks good to me.
@jeremiedbb I think we need this one not to have a discrepancy between partial_dependence and the display in 1.3.
|
I'm okay with that |
|
I just updated the branch with main. CI is green. I'm ok with it being merged as is. :) |
|
Thanks @vitaliset |
This PR fixes #24872.
Built on top of #25209.
As partial dependence of a model at a point is defined as an expectation, as #24872 points out, it should respect
sample_weightif someone wishes to use it (for instance, when you know yourXdoes not follow the distribution you are interested in).The prior PR (#25209) incorporated this logic into the
partial_dependence_plotfunction. This current PR completes the integration by incorporating it intoPartialDependenceDisplay.from_estimator.