Neural network code gives wrong output.!

1 次查看(过去 30 天)
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.!

采纳的回答

Greg Heath
Greg Heath 2017-3-13
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by