当我运行类似的东西时
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)
我得到错误:
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')
有趣的是,A 永远不会是低秩的。 (我认为)
最佳答案
尝试增加 tol。
来自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.
在我的 scikit-learn 版本中,tol 的默认值是 0.0001。我假设您的容忍度很小,以至于优化永远不会达到较低的值。
关于python - sklearn 上的套索不收敛,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20681864/