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