how to test and improve multi layer perceptron
4 views (last 30 days)
Show older comments
amanda hachem
on 13 May 2015
Commented: amanda hachem
on 8 Jun 2015
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 Comments
Accepted Answer
Greg Heath
on 14 May 2015
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
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!