Neural network (NN)

3 visualizzazioni (ultimi 30 giorni)
Kerrollenna Martta
Kerrollenna Martta il 6 Ott 2022
Commentato: Walter Roberson il 22 Ott 2022
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 Commenti
KSSV
KSSV il 6 Ott 2022
Attach your data/ mat files.
Kerrollenna Martta
Kerrollenna Martta il 6 Ott 2022
Meaning? 😅

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 6 Ott 2022
Modificato: Walter Roberson il 6 Ott 2022
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 Commenti
Kerrollenna Martta
Kerrollenna Martta il 6 Ott 2022
Do you have any idea on how can I change it?
Walter Roberson
Walter Roberson il 22 Ott 2022
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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by