Lasso error when precompute='auto'
See original GitHub issueDescribe the bug
The docs state that the precompute
parameter can be “‘auto’, bool or array-like of shape (n_features, n_features)
.” However, attempting to use precompute='auto'
leads to a ValueError
.
Steps/Code to Reproduce
from sklearn.linear_model import Lasso
model = Lasso(precompute='auto')
model.fit([[1, 2], [3, 4]], [[1], [3]])
Expected Results
No error, should “just work.”
Actual Results
Traceback (most recent call last):
File "/opt/project/vpf/elm/tmp.py", line 4, in <module>
model.fit([[1, 2], [3, 4]], [[1], [3]])
File "/usr/local/lib/python3.8/site-packages/sklearn/linear_model/_coordinate_descent.py", line 757, in fit
raise ValueError('precompute should be one of True, False or'
ValueError: precompute should be one of True, False or array-like. Got 'auto'
Versions
Output from sklearn.show_versions()
:
System:
python: 3.8.6 (default, Nov 18 2020, 13:49:49) [GCC 8.3.0]
executable: /usr/local/bin/python
machine: Linux-4.19.104-microsoft-standard-x86_64-with-glibc2.2.5
Python dependencies:
pip: 20.3.3
setuptools: 50.3.2
sklearn: 0.24.0
numpy: 1.19.5
scipy: 1.6.0
Cython: None
pandas: None
matplotlib: None
joblib: 1.0.0
threadpoolctl: 2.1.0
Built with OpenMP: True
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
sklearn.linear_model.LassoCV
The Lasso is a linear model that estimates sparse coefficients. LassoLars. Lasso model fit with Least Angle Regression a.k.a. Lars. LassoCV. Lasso linear ......
Read more >sklearn, LassoCV() and ElasticCV() broken? - Stack Overflow
sklearn provides LASSO method for regression estimation. However, when I try to fit LassoCV(X,y) with y a matrix, it throws an error.
Read more >API Reference — Relaxed Lasso 1.0.0 documentation
This parameter is ignored when fit_intercept is set to False. If True, the regressors X will be normalized before regression by subtracting the...
Read more >sklearn.linear_model.Lasso.fit Example - Program Talk
Got 'invalid'", clf.fit, X, y) # Precompute = 'auto' is not supported for ElasticNet and Lasso assert_raises_regex(ValueError, ".*should be.*True.*False.
Read more >A6 (demo). Regression. Solution - Kaggle
Exploring OLS, Lasso and Random Forest in a regression task ... Question 1: What are mean squared errors of model predictions on train...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can reproduce. This bug does not exist for the other models supporting
precompute
:Thanks for the details. It looks like
precompute
was set toFalse
to handle sparsity: https://github.com/scikit-learn/scikit-learn/pull/19348 offers some clarification.I would just remove the mentions of
'auto'
in the docstring as its support is not present and not relevant.