How to improve the performance of my neural network

8 views (last 30 days)
Hi,i'm trying to create neural network for binary classification of epileptic seizure so i have 2 classes either normal or abnormal and 9 features using an input matrix with a size of [9 981] and target matrix [1 981] . This is my code :
inputs = patientInputs;
targets = patientTargets;
[x,ps] = mapminmax(inputs);
trainFcn = 'trainbr';
% Create a Pattern Recognition Network
hiddenLayerSize =8;
net = patternnet(hiddenLayerSize,trainFcn);
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.performFcn = 'mse';
% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotconfusion', 'plotroc'};
% Train the Network
net= configure(net,x,t);
[net,tr] = train(net,x,t);
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
tind = vec2ind(t);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
% Recalculate Training, Validation and Test Performance
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,y)
valPerformance = perform(net,valTargets,y)
testPerformance = perform(net,testTargets,y)
% View the Network
Unti now i reach only this accuracy with the confusion matrix and i hope to improve it more than this so can anyone help me please ?
  1 Comment
Kaan Simsek
Kaan Simsek on 22 Apr 2021
Hello there. I am a senior student in biomedical engineering. I chose "The detection of the epileptic seizures using CHB-MIT Scalp EEG Database with Deep Learning and CNN" for my graduation thesis. My consultant asked me to use the data on this link "". Please help me for the matlap

Sign in to comment.

Answers (2)

Marco Giuliani
Marco Giuliani on 8 Sep 2017
The first thing I'd suggest is to try a different number of neurons in the hidden layer. Try spacing from 4 to 20 and check the accuracy result. Then you could also try using another learning algorithm, for example the Levenberg-Marquardt.

Greg Heath
Greg Heath on 13 Sep 2017
You violated one of the first design rules:
The rest usually follows from those results.
See the help and doc code for patternnet.
You can also check some of my patternnet post in the NEWSGROUP and ANSWERS.
Hope his helps.

Community Treasure Hunt

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

Start Hunting!

Translated by