问题:

 ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations, check the scale of the features or consider increasing regularisation. Duality gap: 2.080e+01, tolerance: 3.242e+00
  coef_, l1_reg, l2_reg, X, y, max_iter, tol, rng, random, positive

原因:

报错说没有收敛,所以需要增加迭代次数。我的原因是学习率太小了,导致迭代了10000次也没有收敛,所以可以增加迭代次数:max_iter,如下所示:

lasso1 = Lasso(alpha=0.001, max_iter=10000).fit(x_train, y_train)

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐