Python 仅在达到最大值后停止训练MLPREGESSOR(解算器=lbfgs),而不是因为;托尔;
我正在使用Python 仅在达到最大值后停止训练MLPREGESSOR(解算器=lbfgs),而不是因为;托尔;,python,scikit-learn,neural-network,Python,Scikit Learn,Neural Network,我正在使用mlprepressor使用解算器lbfgs训练模型。我已将max_iter参数从默认值200更改为500。我想强制训练持续到500次迭代,当损失没有至少改善tol时,不要停止训练 我已经尝试将tol设置为0.0,然后将其设置为负值(例如-10) 这就是我得到的: The number of iterations ran was: 56 The number of iterations ran was: 162 The number of iterations ran was:
mlprepressor
使用解算器lbfgs
训练模型。我已将max_iter
参数从默认值200更改为500。我想强制训练持续到500次迭代,当损失没有至少改善tol
时,不要停止训练
我已经尝试将tol设置为0.0,然后将其设置为负值(例如-10)
这就是我得到的:
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\u iter
中指定的500)参数tol
指定了优化的公差。如果损失或分数未得到改善,至少达到tol
,则视为已完成培训。尝试将tol
参数设置为None
,因为它指示-无限
,因此训练不会停止,直到达到最大值
mymodel = mlpr(hidden_layer_sizes=(3,), activation = 'tanh', solver =
'lbfgs',max_iter=500, tol=None, verbose=True)
当我运行mymodel=mymodel.fit(xtrain,ytrain)
时,会出现一个错误。尝试在您的系统上运行它。是否有其他方法写入-infinity
?尝试将verbose
参数设置为大于3,以检查'tol'
是否是您所说的主要原因。如果是这样,请将n\u iter\u no\u change
设置为等于n\u iter
mymodel = mlpr(hidden_layer_sizes=(3,), activation = 'tanh', solver =
'lbfgs',max_iter=500, tol=None, verbose=True)