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.!
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!