Neural network (NN)

3 ビュー (過去 30 日間)
Kerrollenna Martta
Kerrollenna Martta 2022 年 10 月 6 日
コメント済み: Walter Roberson 2022 年 10 月 22 日
Hi. I have problem to train my Neural Network. This is the coding.
clear
clc
load c.mat
load OUTPUT1.mat
inputrain = c(1:1000,:);
targetrain = OUTPUT1(1:1000);
[pn,mininputrain,maxinputrain,tn,mintargetrain,maxtargetrain] = premnmx(inputrain,targetrain);
net=newff(minmax(pn),[20,10,1],{'logsig','logsig','purelin'},'trainlm');
net=init(net);
net.trainParam.show = 1;
net.trainParam.lr = 0.9;
net.trainParam.mc = 0.9;
net.trainParam.epochs = 1000;
net.trainParam.goal = 1e-3;
net = train(net,pn,tn);
an = sim(net,pn);
[a] = postmnmx(an,mintargetrain,maxtargetrain);
result_norm = [an' tn'];
result_denorm = [a' targetrain'];
error = mse(tn-an);
mape = mean(abs(error./tn));
rmse = sqrt(mean((error - tn).^2));
[m,b,r] = postreg(a,targetrain);
save net.mat net
The error said " Output data size does not match net.outputs{3}.size." Help me please. Thank you
  2 件のコメント
KSSV
KSSV 2022 年 10 月 6 日
Attach your data/ mat files.
Kerrollenna Martta
Kerrollenna Martta 2022 年 10 月 6 日
Meaning? 😅

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2022 年 10 月 6 日
編集済み: Walter Roberson 2022 年 10 月 6 日
net=newff(minmax(pn),[20,10,1],{'logsig','logsig','purelin'},'trainlm');
You are missing a parameter. The {'logsig'} and so on vector must be the 4th parameter. The first three parameters must be P, T, S where P is input vectors, T is target vectors, and S is sizes of the input layers. S can be [] if you want it to be calculated based upon the sizes of the entries in T.
  2 件のコメント
Kerrollenna Martta
Kerrollenna Martta 2022 年 10 月 6 日
Do you have any idea on how can I change it?
Walter Roberson
Walter Roberson 2022 年 10 月 22 日
premnmx was obsoleted in R2006a, so it is difficult to find documentation for it.
I suspect that maybe you should use
net=newff(pn, tn, [20,10,1], {'logsig','logsig','purelin'}, 'trainlm');
but newff() was obsoleted in R2010b . You should probably modernize the code.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by