-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX support read only view for tree input #16331
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
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 should do the same in _decision_path_dense
otherwise this sounds good to me.
Please add a unit tests that check that trees work with read-only array as input (you can use create_memmap_backed_data
to make one).
Also please add a what's new entry to doc/whats_new/v0.23.rst
indicating that the corresponding tree methods can now be used with joblib based multiprocessing (or @jeremiedbb might suggest a better formulation).
I believe we can remove the test |
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.
Thanks @Batalex, LGTM.
I pushed a small fix to improve the what's new entry given new information from #15851 (comment) and also removed test_decision_tree_memmap as you suggested since it is indeed redundant.
Will merge on green CI.
:class:`ensemble.GradientBoostingClassifier` as well as ``predict`` method of | ||
:class:`tree.DecisionTreeRegressor`, :class:`tree.ExtraTreeRegressor`, and | ||
:class:`ensemble.GradientBoostingRegressor`. | ||
:pr:`16331` by :user:`Alexandre Batisse <batalex>`. |
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.
The list of affected estimators is obtained in #16359
Reference Issues/PRs
Fixes #15851.
What does this implement/fix? Explain your changes.
According to https://cython.readthedocs.io/en/latest/src/userguide/memoryviews.html#read-only-views
This should be fine with scikit-learn since the minimal Cython version supported is 28.5. We could also check the input array for the
writeable
flag and make a copy instead of a view if needed but I figured this solution would be better.Any other comments?
The benchmarks now work as expected.
2020 Paris Sprint