Need help on Neural Network Multiple Classes Training

3 views (last 30 days)
Hi all pros and gurus on mathworks, I've made a neural network classifier according to these codes
P=[ 0.0756 0.0679 0.0848 0.0172 0.0283
0.0000 0.0000 0.0000 0.0000 0.0000
0.0002 0.0002 0.0002 0.0002 0.0001
0.0005 0.0003 0.0005 0.0008 0.0004
0.0004 0.0003 0.0004 0.0012 0.0008
0.0007 0.0004 0.0005 0.0013 0.0049
0.0021 0.0013 0.0015 0.0025 0.0153
0.0071 0.0049 0.0061 0.0075 0.0132
0.0222 0.0184 0.0235 0.0123 0.0078
0.0434 0.0447 0.0551 0.0060 0.0045
0.0470 0.0297 0.0453 0.0011 0.0009]
T=[
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 ]%identity matrix for training target
net = newff(P,T,20,{'tansig','logsig'});
net.performFcn = 'mse';%mean square error
net.trainParam.epochs = 100;
net.trainParam.mc = 0.98;%momentum coefficient
net.trainParam.lr=0.001;%Learning rate
net.trainParam.lr_inc=1.06; %Ratio to increase learning rate
net.trainParam.lr_dec=0.7; %Ratio to decrease learning rate
%train the network net = train(net,P,T); y = sim(net,P);
Pone= [0.0756
0.0000
0.0002
0.0005
0.0004
0.0007
0.0021
0.0071
0.0222
0.0434
0.0470]
Ptwo= [0.0679
0.0000
0.0002
0.0003
0.0003
0.0004
0.0013
0.0049
0.0184
0.0447
0.0297]
Pthree= [0.0848
0.0000
0.0002
0.0005
0.0004
0.0005
0.0015
0.0061
0.0235
0.0551
0.0453]
res1 = sim(net,Pthree); disp('res1='); disp(res1);
[Co,I] = max(res1);
%save the network
save('NNClassifier2five.mat','net')
%data comparison
if (I == 1)
disp('This is a signal of Normal Heart Sound')
elseif (I == 2)
disp('This signal is classified as illness: S3')
elseif (I == 3)
disp('This signal is classified as illness: S4')
elseif (I == 4)
disp('This signal is classified as illness: Aortic Stenosis')
elseif (I == 5)
disp('This signal is classified as illness: Aortic Regurgitation')
else
disp('Error: No Classification is available')
end
I've tried to train the NN using P=[training features] starting from 11x3, 11x4, both of them are returning very well trained and precise NN, My problem now is my Neural network doesn't return satisfying result if my classes are above 5 (11x5)
Anyone can point out my mistakes? I'm still very new to matlab. Hope that I get replies soon

Accepted Answer

Greg Heath
Greg Heath on 9 Jun 2014
Insufficient definition of the 11-dimensional input space.
Even if you trained with 2 vectors per dimension. You probably would not get good results on nontraining data.
Try a more well defined classification/pattern recognition problem.
help newpr (obsolete)
help patternnet (current)
with classification data from
help nndata.
Hope this helps.
Greg

More Answers (0)

Community Treasure Hunt

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

Start Hunting!