FIX support read only view for tree input#16331
Conversation
rth
left a comment
There was a problem hiding this comment.
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 |
rth
left a comment
There was a problem hiding this comment.
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.
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
writeableflag 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