-
-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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] Make cross_val_predict support method="predict_proba" and y=None #15918
[MRG] Make cross_val_predict support method="predict_proba" and y=None #15918
Conversation
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.
Please add a test
@jnothman I think I'm done. Let me know if I missed something or the test I added doesn't look good |
Please edit the pull request title to be more descriptive. It will become the commit message once merged. |
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.
Please add an entry to the change log at doc/whats_new/v0.23.rst
. Like the other entries there, please reference this pull request with :pr:
and credit yourself (and other contributors if applicable) with :user:
…into improve_cross_val_predict
@jnothman I added the entry to the change log. Thanks for your support. |
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.
Thank you for the PR @lkubin !
Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>
@thomasjpfan Thank you for your review. I think that I applied all the changes you were suggesting. Please let me know if I still miss something |
Thanks! |
Reference Issues/PRs
Fixes #15855
Description
cross_val_predict
raises exception when passingmethod="predict_proba"
andy=None
What does this implement/fix? Explain your changes.
The problem is due to the fact that when
method in ['decision_function', 'predict_proba', 'predict_log_proba']
y is cast to numpy arrayy = np.asarray(y)
without checking if y is not None (when casting None to numpy array the singleton arrayarray(None, dtype=object)
is returned).