I try to use lasso regression to solve linear problem with big amount of equations (~10 000). Everything worked fine, but I noticed that if in Y-vector all elements are equal, "fit" function hang for infinite time. As I understand it is the same if Y is the zero-vector (because I set normilize = True)
Then I created minimal examle and wrote this very simple python code:
X = np.array([[1,0], [0, 1]]) Y = np.array([0, 0]) clf = sklearn.linear_model.Lasso() clf.fit(X, Y)
X - 2x2 identity matrix, Y - zero vector Here I got the following error:
C:\Anaconda3\lib\site-packages\sklearn\linear_model\coordinate_descent.py:475: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.0, tolerance: 0.0
So, conclusion here is that lasso regression doesn't converge in case of zero vector And my question is why? Is it fundamental problem? Or it is a bug in sklearn implementation?
It looks strange for me because there is obvious sollution here: all coefs are zero (and norm of this vector is zero as well).
P.S. If I replace Lasso -> Ridge everything works fine again