-
-
Notifications
You must be signed in to change notification settings - Fork 26k
FIX Deep copy criterion in trees to fix concurrency bug #19580
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
3e034f1
to
fc7ce52
Compare
ping @thomasjpfan @glemaitre |
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.
fc7ce52
to
9157002
Compare
9157002
to
75429ea
Compare
Could you please add a changelog entry in |
66491e9
to
3ff8dc2
Compare
Ok, moved changelog entry from v1.0 to v0.24.2 |
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.
Thank you for the PR @samdbrice.
Minor suggestion, otherwise LGTM!
3ff8dc2
to
1abb39d
Compare
Reused the pre-generated data but had to reshape |
…nt segfault caused by concurrent accesses.
1abb39d
to
48c45c5
Compare
Ok, all set. Let me know if there's anything else |
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
…#19580) Co-authored-by: Samuel Brice <samuel.brice@twosigma.com>
Co-authored-by: Samuel Brice <samuel.brice@twosigma.com>
Reference Issues/PRs
Fixes #12623
Adds a smoke test as requested in #12690
Implements deep copy within tree.BaseDecisionTree.fit as requested in #18985
What does this implement/fix? Explain your changes.
The issue is that when trees are created by the base ensemble class, the parameters are not copied. This is problematic in the case of the criterion parameter if a
Criterion
object is passed in. When this happens, all the trees share the same object and mutate it. Ifn_jobs > 1
(or-1
, and we have more than one core available), they are mutating the same object concurrently.Any other comments?
The functional changes of this PR are the same as those in #18985. The deep copy has been moved to within.
BaseDecisionTree.fit
as to be more targeted and prevent possibly costly object deep copies withinBaseEnsemble._make_estimator
.