Filter löschen
Filter löschen

Neural network code gives wrong output.!

1 Ansicht (letzte 30 Tage)
Nimisha
Nimisha am 12 Mär. 2017
Beantwortet: Greg Heath am 13 Mär. 2017
load('testfea.mat')
load('trainfea.mat')
T = [1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16];
P = trainfea';
net = newff(minmax(P),[6 1],{'tansig' 'purelin'});
Y = sim(net,P);
net.trainParam.epochs = 50;
net = train(net,P,T);
P = testfea';
Y = sim(net,P)
trainfea is 128x22 and testfea is 1x22 data, trainfea already contains testfea. But this code gives wrong index as output. Please correct my code for matching.!

Akzeptierte Antwort

Greg Heath
Greg Heath am 13 Mär. 2017
1. What version of MATLAB do you have?
2. Why are you using the extremely obsolete function NEWFF?
3. Do you have the current functions
FITNET(regression/curvefitting)
and
PATTERNNET(classification/pattern-recognition)?
4. Why are you using non-default values of 6 and 50? Don't the defaults work?
5. There is no purpose of using Y = sim with a semicolon before training
6. What does " trainfea already contains testfea " mean??
7. You will probably have to design several nets in a loop to account for the random initial weights.
8. Search NEWSGROUP & ANSWERS using
greg newff
or
greg fitnet
for examples.
Hope this helps.
Thank you for formally accepting my answer
Greg

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by