Lasso on sklearn doesn't converge

When I run something like

import numpy
from sklearn import linear_model
A= #something
b= #something
clf=linear_model.Lasso(alpha=0.015, fit_intercept=False, tol=0.00000000000001,
          max_iter=10000000000000, positive=True)
clf.fit(A,b)

I get an error message:

usr/local/lib/python2.7/dist-packages/scikit_learn-0.14.1-py2.7-linux-x86_64.egg/
sklearn/linear_model/coordinate_descent.py:418: UserWarning: Objective did not
converge. You might want to increase the number of iterations
' to increase the number of iterations')

Interestingly, A never degrades rank. (I think)

+4
source share
1 answer

Try to increase tol.

From the documentation :

tol: float optional

Tolerance for optimization: if there are fewer updates than tol, the optimization code checks for a double gap for optimality and continues until it becomes smaller than tol.

The default tol value is 0.0001 in my version of scikit-learn. I assume that your tolerance is so small that the optimization never reaches a lower value.

+8

All Articles