Skip to content
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

[MRG] DOC Fix incorrect documented output shape for predict method of linear models when n_targets > 1 #29026

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hchau630
Copy link

Reference Issues/PRs

Fixes #29009.

What does this implement/fix? Explain your changes.

This fix updates the documentation of the predict method of all linear models which support multiple output/targets to account for the possibility of having a return value with shape (n_samples, n_targets) rather than (n_samples,). To do this, all classes which subclass both LinearModel and MultiOutputMixin now instead subclass a new class MultiOutputLinearModel (which itself subclasses both LinearModel and MultiOutputMixin) that has a predict method with the correct documentation.

Any other comments?

This is my first pull request, so apologies in advance for any mistakes throughout this process.

Copy link

github-actions bot commented May 15, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: eb6d0f4. Link to the linter CI: here

@hchau630 hchau630 changed the title [MRG] Fix incorrect documented output shape for predict method of linear models when n_targets > 1 [MRG] DOC Fix incorrect documented output shape for predict method of linear models when n_targets > 1 May 15, 2024
@hchau630
Copy link
Author

hchau630 commented May 15, 2024

During this process I also noticed that some linear models seem to have incorrect documentation in their fit method. In particular the fit method of RidgeClassifier and RidgeClassifierCV accepts target values y with shape (n_samples, n_target) and not just (n_samples,), which should be reflected in the documentation. Not sure if there are also other classes with the same issue. Could open a new issue about this.

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.

Incorrect documented output shape for predict method of linear models when n_targets > 1
1 participant