[MRG] Make cross_val_predict support method="predict_proba" and y=None - #15918
Merged
Conversation
Contributor
Author
|
@jnothman I think I'm done. Let me know if I missed something or the test I added doesn't look good |
Member
|
Please edit the pull request title to be more descriptive. It will become the commit message once merged. |
jnothman
approved these changes
Dec 19, 2019
jnothman
left a comment
Member
There was a problem hiding this comment.
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:
added 2 commits
December 20, 2019 08:48
…into improve_cross_val_predict
Contributor
Author
|
@jnothman I added the entry to the change log. Thanks for your support. |
thomasjpfan
reviewed
Dec 20, 2019
thomasjpfan
left a comment
Member
There was a problem hiding this comment.
Thank you for the PR @lkubin !
Co-Authored-By: Thomas J Fan <thomasjpfan@gmail.com>
Contributor
Author
|
@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 |
jnothman
approved these changes
Dec 23, 2019
Member
|
Thanks! |
panpiort8
pushed a commit
to panpiort8/scikit-learn
that referenced
this pull request
Mar 3, 2020
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reference Issues/PRs
Fixes #15855
Description
cross_val_predictraises exception when passingmethod="predict_proba"andy=NoneWhat 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).