-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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
base: main
Are you sure you want to change the base?
Conversation
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 |
I think the shape should not change for existing problem (e.g. fitting a |
@ogrisel Sure I will add a new test case for the multi-output multiclass classification problem? |
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) |
@rana-akkumar would you still like to work on this? Thanks |
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).