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 件のコメント

Greg Heath
Greg Heath 2015 年 5 月 14 日
Please explain why the {0,1} target is giving you problems.
It shouldn't.
amanda hachem
amanda hachem 2015 年 5 月 29 日
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 件のコメント

amanda hachem
amanda hachem 2015 年 6 月 8 日
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 ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by