Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 仅在达到最大值后停止训练MLPREGESSOR(解算器=lbfgs),而不是因为;托尔;_Python_Scikit Learn_Neural Network - Fatal编程技术网

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)