一个帅气的boy,你可以叫我Love And Program
⌨个人主页:Love And Program的个人主页
如果对你有帮助的话希望三连支持一下博主
在执行LogisticRegression(solver = ‘lbfgs’)时出现如下错误: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
n_iter_i = _check_optimize_result(
此处已经告诉如何更改,增大最大迭代值,使用如下代码即可
LogisticRegression(solver = 'lbfgs',max_iter=10000)
在pycharm中我们可以ctrl
+鼠标左键
进入函数内部,我们点击LogisticRegression
即可查看还可以更改什么其他参数
def __init__(
self,
penalty="l2",
*,
dual=False,
tol=1e-4,
C=1.0,
fit_intercept=True,
intercept_scaling=1,
class_weight=None,
random_state=None,
solver="lbfgs",
max_iter=100,
multi_class="auto",
verbose=0,
warm_start=False,
n_jobs=None,
l1_ratio=None,
):
如果你想看过程命令verbose=1
即可
RUNNING THE L-BFGS-B CODE
* * *
Machine precision = 2.220D-16
N = 7850 M = 10
At X0 0 variables are exactly at the bounds
At iterate 0 f= 1.38155D+05 |proj g|= 1.00073D+04
At iterate 50 f= 1.27352D+04 |proj g|= 5.42858D+01
.
.
.