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

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

Open
hchau630 opened this issue May 13, 2024 · 2 comments · May be fixed by #29026
Open

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

hchau630 opened this issue May 13, 2024 · 2 comments · May be fixed by #29026

Comments

@hchau630
Copy link

hchau630 commented May 13, 2024

Describe the issue linked to the documentation

For some classes under sklearn.linear_model such as LinearRegression, Ridge, RidgeCV, and a bunch of others, the documentation for the predict method states that it returns

C : array, shape (n_samples,)
            Returns predicted values.

However, this is incorrect when the model is fitted with y with shape (n_samples, n_targets), i.e. n_targets > 1, in which case the returned array should have shape (n_samples, n_targets).

Suggest a potential alternative/fix

The documentation for the return value of the predict method should be

C : array, shape (n_samples,) or (n_samples, n_targets)
            Returns predicted values.
@hchau630 hchau630 added Documentation Needs Triage Issue requires triage labels May 13, 2024
@glemaitre
Copy link
Member

Indeed, it should be fixed. Thanks for noticing @hchau630. Do you wish to make a pull-request to address this problem?

@glemaitre glemaitre removed the Needs Triage Issue requires triage label May 15, 2024
@hchau630
Copy link
Author

Sure, should be a quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants