Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
 
 
主题工具 显示模式
旧 2019-11-26, 05:22   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 MATLAB feedforwardnet using gradient descent fails the first time

I am training a feedforwardnet with gradient descent traingd as backpropagation algorithm to predict times table.



X = [repmat([1:10]', 10, 1) repelem([1:10]', 10)];
y = X(:, 1) .* X(:, 2);

net = feedforwardnet(8); % Create a neural network with 8 neurons in the hidden layer
net.layers{1}.transferFcn = 'logsig'; % Hidden layer activation function set to logsig
net.trainFcn = 'traingd'; % Set backpropagation algorithm to gradient descent
net.divideParam.trainRatio = 0.6;
net.divideParam.testRatio = 0.2;
net.divideParam.valRatio = 0.2;
[net, TR] = train(net, X', y'); % Train the network


Whenever I first train the network the lowest validation error is too high as you can see below.



Training with gradient descent



But then if I change my backpropagation algorithm to Levenberg-Marquardt trainlm, train the network and then switch back to gradient descent traingd and train again then my lowest validation error starts making sense.



Why is my training failing for the first time when I train it using gradient descent?



Training with levenberg-marquardt



Training with gradient descent after switching from trainlm





More answer...
poster 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 19:19


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.