Lasso on sklearn does not converge

least-squares, machine-learning, python, scikit-learn

Solution

Try increasing tol.

From the documentation:

tol : float, optional

The tolerance for the optimization: if the updates are smaller than tol, the optimization code checks the dual gap for optimality and continues until it is smaller than tol.

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

Problem

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 the error: ``` 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') ``` The interesting thing is that A is never rank defficient. (I think)

Original source