got*_*ota 9 python machine-learning least-squares scikit-learn
当我运行类似的东西
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)
Run Code Online (Sandbox Code Playgroud)
我收到错误:
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')
Run Code Online (Sandbox Code Playgroud)
有趣的是,A从来没有排名低效.(我认为)
有时帮助我摆脱警告的唯一一件事是显着增加迭代次数(显着增加训练时间)。
Increasing the tolerance always led to the same warnings, but with larger values in them, and not to getting rid of the warnings. Not sure why.
As an important analytical side note, I interpret getting this warning initially when using Lasso regression as a bad sign, regardless of what happens next.
For me it practically always occurred in the situation when the model was over-fitting, meaning that it performed well on the full training set itself, but then poorly during cross-validation and testing.
Regardless of whether I had supressed the warning (there is a way) or had gotten rid of it "naturally" by increasing the number of iterations, I almost always had to go back and simplify the set of features for Lasso to be effective (and in some cases to abandon Lasso altogether in favor of a different model).
归档时间: |
|
查看次数: |
14456 次 |
最近记录: |