Repository navigation
[MRG] fix ClassifierChain issue when a tuple is passed to order - #18124
Merged
Merged
Conversation
rth
reviewed
Aug 11, 2020
rth
left a comment
Member
There was a problem hiding this comment.
Thanks @amy12xx . LGTM aside for one comment below.
Please add an entry to the change log at doc/whats_new/v0.24.rst. Like the other entries there, please reference this pull request with :pr: and credit yourself (and other contributors if applicable) with :user:.
Co-authored-by: Roman Yurchak <[email protected]>
…learn into classifier_chain
rth
approved these changes
Aug 15, 2020
Co-authored-by: Roman Yurchak <[email protected]>
thomasjpfan
reviewed
Aug 15, 2020
Co-authored-by: Thomas J. Fan <[email protected]>
Co-authored-by: Thomas J. Fan <[email protected]>
…learn into classifier_chain
jnothman
reviewed
Aug 16, 2020
| if self.order_ is None: | ||
| self.order_ = np.array(range(Y.shape[1])) | ||
| elif isinstance(self.order_, tuple): | ||
| self.order_ = np.array(self.order_) |
Member
There was a problem hiding this comment.
we need to check that sorted(self.order_) == list(range(Y.shape[1])) as below
thomasjpfan
reviewed
Aug 16, 2020
Comment on lines
+623
to
+625
| else: | ||
| msg = 'invalid order' | ||
| assert_raise_message(ValueError, msg, chain.fit, X, y) |
Member
There was a problem hiding this comment.
Let's define another test function to test for this assertion and use pytest.raises.
…into classifier_chain
jnothman
reviewed
Aug 17, 2020
Co-authored-by: Joel Nothman <[email protected]>
jayzed82
pushed a commit
to jayzed82/scikit-learn
that referenced
this pull request
Oct 22, 2020
…it-learn#18124) * fix error tuple passed to order * fix linting * Update sklearn/tests/test_multioutput.py Co-authored-by: Roman Yurchak <[email protected]> * updated test and whatsnew * doc fix * Update doc/whats_new/v0.24.rst Co-authored-by: Roman Yurchak <[email protected]> * Update sklearn/tests/test_multioutput.py Co-authored-by: Thomas J. Fan <[email protected]> * Update sklearn/tests/test_multioutput.py Co-authored-by: Thomas J. Fan <[email protected]> * code review fix * code review fix * added test * code review fix * Update sklearn/multioutput.py Co-authored-by: Joel Nothman <[email protected]> Co-authored-by: Roman Yurchak <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]> Co-authored-by: Joel Nothman <[email protected]>
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.
Fixes #17855, where if you passed a tuple to the order parameter to ClassifierChain, predict and predict_proba would throw an error.
Reference Issues/PRs
Closes #17890