-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX error when deserialzing a Tree instance from a read only buffer #25585
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b5e5ddd
FIX error when deserialzing a Tree from a read only buffer
OmarManzoor b3e01d2
Improve the test and remove the partial display plot
OmarManzoor 417a801
Fix windows compile error by using cnp.PyArray_DATA instead of const …
OmarManzoor 79b7c57
Improve docstring comment of added test
OmarManzoor 077ab59
Test that the classifier trees are equal
OmarManzoor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Instead of indirectly relying on joblib parallelism via partial dependence computation, it would be better to write a non-regression test based on unpickling from a readonly buffer. This can be done as explained in this comment #25584 (comment).
To do this in a test, you could use the
tmpdir
fixture from pytest.Also this would be great to write this test as a new estimator check to be run by
test_common.py
for any scikit-learn estimator, not just decision trees.I thought we already had such a common test but apparently this is not the case.
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.
Indeed.
I need to improve my knowledge of common tests; ideally we must assert Cython implementations' correct behavior on (memmapped) readonly datasets.
@OmarManzoor: do you see how you can perform what Olivier has mentioned?
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.
I did check the common tests and from what I understand we need to replicate the behavior in this PR to all estimators in the common tests.
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.
Yes, for the scope of this PR, you can stick to the remarks in the two first paragraph of #25585 (comment).
Then, the general coverage explained in the third and fourth paragraphs of #25585 (comment) better be treated in another pull request IMO. I think you can author another PR for it if you are interested but you need not to for this current PR to be accepted.
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.
Okay sounds good. I think this PR can be merged then?
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.
I let @ogrisel merge when this LGTH (I am not 100% sure that the current state of the test satisfies what he indicated in this thread first comment).
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 as it is. Let's do the common test in a follow-up PR.