-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG+1] FIX Pickled sample_weights in BinaryTree #11774
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
[MRG+1] FIX Pickled sample_weights in BinaryTree #11774
Conversation
Thanks @NicolasHug for the PR |
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.
Nice work debugging
joblib.dump(kde, file_path) | ||
kde = joblib.load(file_path) | ||
scores_pickled = kde.score_samples(X) | ||
|
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.
To be sure, can you check that the tree is of the right type?
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 I missed that one.
It was an issue in BinaryTree
and dates back as far as 226fe51 !
Prior to this change, they would become a generic BinaryTree object
Good work! Please add an entry to the change log at |
…into binary_tree_sample_weights
Thanks a lot @NicolasHug! |
Reference Issues/PRs
Fixes #11769
What does this implement/fix? Explain your changes.
This PR adds the
sample_weight
attribute to the list of pickled attributes ofBinaryTree
, which fixes bugs such as the one in #11769.Also, pickled KDTree and BallTree instances now keep their classes. Before, they would become BinaryTree objects.
Any other comments?
I added a basic test which is basically the sample code in #11769, but this is only testing a side effect of the changes. I'm not sure what could be more relevant here.