Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Extend ClassifierChain to multi-output problems (ClassifierChain.decision_function) #21942

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from

Conversation

rana-akkumar
Copy link

@rana-akkumar rana-akkumar commented Dec 10, 2021

Reference Issues/PRs
Fixes #13339
Fixes #9245

What does this implement/fix? Explain your changes.

I have done changes in "ClassifierChain.decision_function" method to support multioutput-multiclass.
Now the output will be (n_samples, n_classes, n_outputs) instead of (n_samples, n_classes), with an exception for binary classifier where n_classes will be one instead of two.
I also have to make suitable changes in test function "test_classifier_chain_fit_and_predict_with_linear_svc" which is present in "sklearn/tests/test_multioutput.py".

Any other comments?

This can break backward compatibility, since the output now of shape (n_samples, n_classes, n_outputs).

@rana-akkumar rana-akkumar changed the title FIX 13339: Bad error messages in ClassifierChain on multioutput multi… FIX Bad error messages in ClassifierChain on multioutput multi… Dec 10, 2021
@rana-akkumar rana-akkumar changed the title FIX Bad error messages in ClassifierChain on multioutput multi… Extend ClassifierChain to multi-output problems (ClassifierChain.decision_function) Dec 10, 2021
@ogrisel
Copy link
Member

ogrisel commented Dec 10, 2021

To clarify the purpose of this PR, can you please add a new test for the multi-output multiclass classification problem?

https://scikit-learn.org/stable/modules/multiclass.html#multiclass-multioutput-classification

@ogrisel
Copy link
Member

ogrisel commented Dec 10, 2021

This can break backward compatibility, since the output now of shape (n_samples, n_classes, n_outputs).

I think the shape should not change for existing problem (e.g. fitting a ClassifierChain on a multi-label classification problem, which is equivalent to multioutput binary classification, should still behave as in scikit-learn 1.0, without having to adjust the existing tests).

@rana-akkumar
Copy link
Author

@ogrisel Sure I will add a new test case for the multi-output multiclass classification problem?

sklearn/multioutput.py Show resolved Hide resolved
@rana-akkumar
Copy link
Author

This can break backward compatibility, since the output now of shape (n_samples, n_classes, n_outputs).

I think the shape should not change for existing problem (e.g. fitting a ClassifierChain on a multi-label classification problem, which is equivalent to multioutput binary classification, should still behave as in scikit-learn 1.0, without having to adjust the existing tests).

Yes, that can done. But in that case "ClassifierChain.decision_function" will produce two test cases one for multi-output binary-class classification of shape (n_samples, n_outputs) and the other for multi-output multiclass classification of shape (n_samples, n_classes, n_outputs)

@ogrisel
Copy link
Member

ogrisel commented Dec 10, 2021

Yes, that can done. But in that case "ClassifierChain.decision_function" will produce two test cases one for multi-output binary-class classification of shape (n_samples, n_outputs) and the other for multi-output multiclass classification of shape (n_samples, n_classes, n_outputs)

I replied concurrently here: #21942 (review)

@lucyleeow
Copy link
Member

@rana-akkumar would you still like to work on this? Thanks

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.

Bad error messages in ClassifierChain on multioutput multiclass Extend ClassifierChain to multi-output problems
5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.