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

DOC correct Xy shape in lars_path and lars_path_gram #28419

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

yuanx749
Copy link
Contributor

Reference Issues/PRs

Ran into the same issue as #27887 when using lars_path.

What does this implement/fix? Explain your changes.

After going through the source code of _lars_path_solver, I think these functions only work for single-target y, therefore suggest the changes in docstrings.

Any other comments?

Code to reproduce errors.

from sklearn.datasets import make_regression
from sklearn.linear_model import lars_path, lars_path_gram
X, y = make_regression(n_features=10, n_targets=2, random_state=0)
Xy = np.dot(X.T, y)
Gram = np.dot(X.T, X)
lars_path(X, y, Xy=Xy, Gram=Gram)  # ValueError
lars_path_gram(Xy, Gram=Gram, n_samples=X.shape[0])  # ValueError

Copy link

✔️ Linting Passed

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

Generated for commit: 2b3175f. Link to the linter CI: here

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@glemaitre glemaitre merged commit ed76f01 into scikit-learn:main Feb 14, 2024
33 checks passed
@yuanx749 yuanx749 deleted the lars_xy_shape branch February 15, 2024 03:50
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.

2 participants