Skip to content

Lasso error when precompute='auto' #19283

@blthayer

Description

@blthayer

Describe 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions