Thanks to visit codestin.com
Credit goes to github.com

Skip to content

don't set check_pickle on new joblib on python2.7 #12645

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 1 commit into from
Nov 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sklearn/neighbors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,12 @@ class from an array representing our data set and ask who's
raise ValueError(
"%s does not work with sparse matrices. Densify the data, "
"or set algorithm='brute'" % self._fit_method)
if (sys.version_info < (3,) or
LooseVersion(joblib_version) < LooseVersion('0.12')):
old_joblib = LooseVersion(joblib_version) < LooseVersion('0.12')
if sys.version_info < (3,) or old_joblib:
# Deal with change of API in joblib
check_pickle = False if old_joblib else None
delayed_query = delayed(_tree_query_parallel_helper,
check_pickle=False)
check_pickle=check_pickle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why we have a different behavior with python2.7 here.
Shouldn't is be only dependent on the version of joblib?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You introduced this in #12172 because in 2.7 balltree is not picklable (according to your issue description)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not realize I was to blame for this. Yes indeed it is needed.
Sorry for the noise.

parallel_kwargs = {"backend": "threading"}
else:
delayed_query = delayed(_tree_query_parallel_helper)
Expand Down