-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Working feature is falsely suppressed [Lasso & ElasticNet for sparse matrices with weights] #21700
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
Comments
I don't think that this is right. You might get a result but it is probably not the good one. The function scikit-learn/sklearn/linear_model/_base.py Lines 807 to 831 in f4de2d1
pinging @agramfort @lorentzenchr that worked on this and might recall if this is the real issue for limiting |
Thanks for looking into this. I have checked that the method yields the same results whether the matrix X is dense or not, so either there is a bigger problem but if there is, it isnt related to a sparse vs dense system matrix X unless I am missing something (I have edited the code to show that using weights changes the results).
|
you have a typo. It should be:
|
and fixing this your test don't pass anymore |
thanks for pointing this out, is there interest to fix it? |
sure if you have time please give it a try !
|
@agramfort to be sure, we don't currently support this case. Basically, there is no bug but it would be an enhancement then? |
> there is no bug but it would be an enhancement then?
yes
|
Lasso/Enet + sample weights + sparse input is currently the only missing combination to close #3702. Contributions would be very welcome. I'm therefore closing this issue. |
Describe the bug
Please remove the checks to allow sparse matrices in Lasso and ElasticNet since it actually is already supported.
Relevant files are:
ElasticNet.fit(...):
l.956 sklearn/linear_model/_coordinate_descent.py
See
https://github.com/scikit-learn/scikit-learn/compare/main...draphi:sample_weights_sparse_matrix?expand=1
Steps/Code to Reproduce
Expected Results
Actual Results
ValueError: Sample weights do not (yet) support sparse matrices.
Versions
System:
python: 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
executable: C:\Python\conda\python.exe
machine: Windows-10-10.0.19041-SP0
Python dependencies:
pip: 19.2.3
setuptools: 41.4.0
sklearn: 1.0.1
numpy: 1.21.4
scipy: 1.7.2
Cython: 0.29.13
pandas: 1.3.4
matplotlib: 3.1.1
joblib: 0.13.2
threadpoolctl: 3.0.0
Built with OpenMP: True
The text was updated successfully, but these errors were encountered: