- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用求解器 lbfgs
使用 MLPRegressor
训练模型。我已将 max_iter
参数从默认的 200 更改为 500。我想强制训练继续进行 500 次迭代,并且当损失没有改善至少 tol
时不要停止>。
我已经尝试将 tol 设置为 0.0,然后继续将其设置为负值(例如 -10)
mymodel = mlpr(hidden_layer_sizes=(3,), activation = 'tanh', solver =
'lbfgs',max_iter=500, tol=0.0, verbose=True)
for i in range(99):
mymodel = mymodel.fit(xtrain,ytrain)
print("The number of iterations ran was: ",mymodel.n_iter_)
这就是我得到的:
The number of iterations ran was: 56
The number of iterations ran was: 162
The number of iterations ran was: 154
The number of iterations ran was: 169
The number of iterations ran was: 127
The number of iterations ran was: 40
The number of iterations ran was: 501
The number of iterations ran was: 501
The number of iterations ran was: 502
The number of iterations ran was: 198
我预计每次都会有 500 次迭代。 (甚至不是 501 或 502,因为它们超过了我在 max_iter
中指定的 500)
最佳答案
tol
参数指定优化的容差。如果损失或分数没有改善至少 tol
,当达到收敛时,训练被认为完成。尝试设置tol
参数None
,如其所示 -infinity
,因此训练不会停止,直到 max_iter
已达到。
mymodel = mlpr(hidden_layer_sizes=(3,), activation = 'tanh', solver =
'lbfgs',max_iter=500, tol=None, verbose=True)
关于python - 仅在 max_iter 之后停止训练 MLPRegressor (solver=lbfgs),而不是因为 "tol",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55988440/
我正在做多类/多标签文本分类。我试图摆脱“ConvergenceWarning”。 当我调了 max_iter 从默认到 4000 ,警告消失。但是,我的模型精度从 降低了78 至 75 . from
我想了解类 sklearn.cluster.KMeans 中的参数 max_iter . 根据文档: max_iter : int, default: 300 Maximum number of it
神经网络 (NN) epoch 与 scikit-learn 中的 max_iter 参数有什么区别或关系? 例如,如代码中所示,从 1 到 10000 评估 max_iter 的 NN 模型并评估每
我正在使用求解器 lbfgs 使用 MLPRegressor 训练模型。我已将 max_iter 参数从默认的 200 更改为 500。我想强制训练继续进行 500 次迭代,并且当损失没有改善至少 t
这是设置: test_observations : 6,767; train_observations: 73,268; train/test batch_size = 50; 我应该如何设置batc
我正在使用 Python 来预测值并收到许多警告,例如: Increase the number of iterations (max_iter) or scale the data asshown
我正在使用 Python 来预测值并收到许多警告,例如: Increase the number of iterations (max_iter) or scale the data asshown
我是一名优秀的程序员,十分优秀!