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
FIX Allow sparse input data for OutputCodeClassifier #17233
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.
2 small changes (more for the style I should admit).
It remains a thing. Could you add an entry in doc/whats_new/0.24.rst
in a section sklearn.multiclass
and state this change as a |Fix|
. You should credit yourself and this PR as well.
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.
LGTM. We will need a second review on this.
@rth @jeremiedbb @jnothman @thomasjpfan @NicolasHug @adrinjalali can you give a look at it.
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.
LGTM otherwise, thanks @zoj613
I merge master where we add some changes that simplified the tests. If the tests pass I will merge it. |
Thanks @zoj613 |
Reference Issues/PRs
Fixes #17218
What does this implement/fix? Explain your changes.
This PR fixes a TypeError bug that occurs when fitting OutputCodeClassifier using sparse input data.
As suggested by @glemaitre I added the
allow_sparse=True
keyword argument to_validate_data
andcheck_array
functions inside the methodsfit
andpredict
. This allows the base estimator to handle the data check and throw the appropriate exception if sparse input is not allowed. I added a test case as well.