Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.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
R中神经网络在给定重复次数下不收敛的算法_R_Algorithm_Neural Network_Convergence - Fatal编程技术网

R中神经网络在给定重复次数下不收敛的算法

R中神经网络在给定重复次数下不收敛的算法,r,algorithm,neural-network,convergence,R,Algorithm,Neural Network,Convergence,我不熟悉R中的神经网络。我试图模拟以下使用java中的neuroph实现的行为 类型-多层感知器,输入-7,输出-1,隐藏-5神经元,传递函数-S形,学习规则-反向传播,最大误差-0.01,学习率-0.2 下面是我实现的R代码 net.result <- neuralnet(Output ~ Input1 + Input2 + Input3 + Input4 + Input5 + Input6 + Input7, traindata, al

我不熟悉R中的神经网络。我试图模拟以下使用java中的neuroph实现的行为

类型-多层感知器,输入-7,输出-1,隐藏-5神经元,传递函数-S形,学习规则-反向传播,最大误差-0.01,学习率-0.2

下面是我实现的R代码

net.result <- neuralnet(Output ~ Input1 + Input2 + Input3 + Input4 + Input5 + Input6 + Input7, 
                        traindata, algorithm = "backprop", hidden = 5,
                        threshold = 0.01, learningrate = 0.2, act.fct = "logistic", 
                        linear.output = FALSE, rep =50, stepmax = 100)
以下是执行上述命令时得到的警告

Warning message:
algorithm did not converge in 50 of 50 repetition(s) within the stepmax

关于为什么会发生这种情况,有什么解释吗?

将“stepmax”从100增加到某个较大的值,以便给算法更多的收敛时间。但是,更好的方法是减少隐藏节点的数量,然后重新运行神经网络

您可以更改隐藏层/隐藏节点的数量,并通过反复试验尝试不同的组合。可以尝试将MLP中的隐藏层数增加到2。很少使用带有2个隐藏层的MLP,但它们在数据中的复杂模式中确实有其用途。理论上,具有2个隐藏层的MLP可用于近似任何函数。

I将stepmax增加到1e5,但仍然会产生类似的警告消息。当我将隐藏节点的数量减少到3个时,它成功地工作了。你知道为什么不能用更多的隐藏神经元来构建模型吗?隐藏节点的数量通常取决于输入节点和输出节点的数量。因为在你的例子中,你有7个输入节点和1个输出节点;因此,隐藏节点的数量应小于或等于4。选择隐藏节点数时使用的一种常见做法是输入和输出节点的平均值。希望能有帮助。
Warning message:
algorithm did not converge in 50 of 50 repetition(s) within the stepmax