-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
MAINT Handle Tree.sample_weight
using a memoryview
#24994
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
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Tree.sample_weight
using a memoryview
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 modulo some nitpicks for using this PR as an opportunity to improve those implementations' readability.
Co-authored-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.
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.
We just need to have a bench to show that there is no regression. Otherwise LGTM.
Results show no performance regression.
|
Reference Issues/PRs
Fixes: #24987
What does this implement/fix? Explain your changes.
Refactors all instances where
sample_weight
was a DOUBLE_t pointer to a Cython DOUBLE_t memoryview.@jshinm will assist in running asv benchmarks to confirm that there is no performance regression once #24678 is merged and this is rebased on top of those changes.
Note that changing LOC
if sample_weight != NULL:
toif sample_weight != None:
should not impact nogil performance. See this thread: https://stackoverflow.com/questions/63144139/how-to-check-whether-a-memmoryview-in-null-in-cython#comment131530483_63167895.Any other comments?
This should be rebased and merged after #24678 is reviewed and merged.