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

Skip to content

FIX Fix available_if with bounded methods #23077

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 4 commits into from
Apr 19, 2022

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Apr 8, 2022

Reference Issues/PRs

Fixes #21344

What does this implement/fix? Explain your changes.

I think using MethodType is the recommended way to bound a method descriptor in Python.

Adding to milestone 1.1 since #21344 is on the milestone.

@thomasjpfan thomasjpfan changed the title WIP FIX Fix available_if with bounded methods Apr 8, 2022
@thomasjpfan thomasjpfan added this to the 1.1 milestone Apr 8, 2022
Non-regression test for #21344.
"""
est = AvailableParameterEstimator(available=True)
pickle.dumps(est.available_func)
Copy link
Member

Choose a reason for hiding this comment

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

Could we make the round-trip by loading the pickle as well?

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

LGTM pending @glemaitre 's point.

@thomasjpfan
Copy link
Member Author

In effd281, I introduced some state so we can check that the road-tripped pickled method keeps the state of the object.

@glemaitre glemaitre merged commit ff8387e into scikit-learn:main Apr 19, 2022
@glemaitre
Copy link
Member

Thanks LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot pickle predict_proba function with 1.0 release
3 participants