how to test and improve multi layer perceptron

My project is about apnea detection based on ECG features; I have 11 features for each ECG and my data set is 100 Apnea and 100 normal signal. I choosed newff to implement the classifier with one hidden layer of 8 neurons and I have divided the data into training and testing. The problem is that I assumed '1' as apnea target and '0' as normal target but when it comes to testing the output is not convenient at all Here is my code where R is the training set,T is its target and S is the testing set
function[Output,trained_net,stats]= net_train(R,T,S)
net = newff(R', T, [8], {'tansig' 'logsig'}, 'traingd', ... '', 'mse', {}, {}, '');
net=init(net);
net.trainparam.min_grad=0;
net.trainparam.epochs=1000;
[trained_net,stats]=train(net,R',T);
Output=sim(trained_net,S');
end

댓글 수: 2

Please explain why the {0,1} target is giving you problems.
It shouldn't.
I improved my algorithm and when training I reached 95% accuracy but the testing is still not working (almost 35%).
function[Y,net]=MLPNN(R,T,S)
rand('seed', 672880951)
net = newff(minmax( R ),[11,11,1],{'tansig','logsig','logsig'});
net.trainFcn='trainscg';
net.trainParam.epochs=1000;
net=train(net,R,T);
Y=round(sim(net,S));
end
R the training data is composed of 50 consecutive apnea records and 50 consecutive normal records and so does the testing data S.
the output should be like [ones(1,50) zeros(1,50)] but it does not. Any idea?

댓글을 달려면 로그인하십시오.

 채택된 답변

Greg Heath
Greg Heath 2015년 5월 14일

0 개 추천

NEWPR is the version of NEWFF that should be used for classification/pattern-recognition
Remove ending semicolons to see command line printout:
target = ind2vec(trueclassindices);% Use for training
trueclassindices = vec2ind(target);
...
output = net(input);
predictedclassindices = vec2ind(output);
err = predictedclassindices ~= trueclassindices; % ones and zeros
Nerr = sum(err);
PctErr = 100*Nerr/N
classification breakdowns of the trn/val/tst subsets can be obtained using the training record tr obtained from
[ net tr output error ] = train(net,input,target);
% output = net(input);
% error = target-output;
tr = tr % No semicolon to see the goodies
Hope this helps.
Thank you for formally accepting my answer
Greg

댓글 수: 1

thanks for helping it worked but i have another question.
Now i'm using newrb to classify using Radial basis but it immediately reaches minimum gradient. What do i have to change?
Thank you for your help

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2015년 5월 13일

댓글:

2015년 6월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by