-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH Monotonic Contraints for Tree-based models #13649
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
DecisionTrees RandomForests GradientBoosting
Very interested in this, please ping me when you have something! |
I added a few tests to check that the implementation actually enforced the monotonicity constraints, but they are failing... |
Two issues:
|
@samronsin LMK when you need reviews. I've implemented monotonic constraints for the hist-GBDTs in #15582 It's still under review so your comments are more than welcome there. I think you'll also find some tests worth using. They helped me a great deal in debugging my code |
Yes. Maybe this be done by just reversing the constraint? Not sure
You don't seem to be constraining the values of the children based on the average value of a pair of siblings. You'll need to introduce lower and upper bounds to the nodes values for monotonic constraints to be properly enforced (see https://github.com/scikit-learn/scikit-learn/pull/15582/files#diff-9bd2ee07fb6817a0aee54f959d32de8aR139). |
6303f8c
to
65c0ad0
Compare
65c0ad0
to
16a8863
Compare
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! Thank you very much @samronsin!
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
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! Thank you for your notable contribution, your persistence, and your patience, @samronsin.
@lorentzenchr: are you interested in having a look at this PR before merging it?
Thank you @jjerphan, @ogrisel and @NicolasHug for your invaluable help on this PR ! Very happy to see this work landing eventually ! |
At yesterday's monthly meeting, we mentioned that it would be appropriate to test data structure consistency between HGBT's and DecisionTree's when constraints of monotonicity are used. I think we better do it in a subsequent PR. I will merge this PR on Friday if no-one objects in the meantime. |
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.
Some minor comments.
I would wait for @lorentzenchr's approval before merging. |
🎉 |
Co-authored-by: Pat O'Reilly <patrick.oreilly256@gmail.com> Co-authored-by: dsleo <leooleds@gmail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Pat O'Reilly <patrick.oreilly256@gmail.com> Co-authored-by: dsleo <leooleds@gmail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Continuation of PR #7266 addressing issue #6656 and #18982.
TODO:
implement logic for new trees in [MRG+2] Faster Gradient Boosting Decision Trees with binned features #12807(already done by [MRG] Monotonic constraints for GBDT #15582)increasing
anddecreasing
) => let's go with themontonic_cst
array