Bad accuracy in the confusion matrix of neural network

5 Ansichten (letzte 30 Tage)
afef
afef am 11 Jun. 2017
Hi,i tried to create neural network for classification using nprtool i used the advanced script so i could normalize my data but in my cofusion matrix the accuracy is not that good.Tis is my code :
x =patientInputs;
t = patientTargets;
setdemorandstream (391418381)
trainFcn = 'trainscg';
hiddenLayerSize = 24;
net = patternnet(hiddenLayerSize);
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand';
net.divideMode = 'sample';
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.performFcn = 'crossentropy';
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotconfusion', 'plotroc'};
[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);
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(net)
And this is the confusion matrix that i got
Please can anyone help me what should i modify in my code to improve the accuracy of my neural network ?

Antworten (1)

orlem lima dos santos
orlem lima dos santos am 9 Jan. 2018
Bearbeitet: orlem lima dos santos am 9 Jan. 2018
Hi, to obtain a better accuracy what I recommend to you is find the best hyperparameters (numbers node in the hidden layer, epochs and so on) of your network in order to do this you could go try and error or use algorithms like gridsearch (best option)
https://www.mathworks.com/matlabcentral/fileexchange/63132-grid-search-function-for-neural-networks.
This algorithm is going to give you the best hyperparameters given the inputs and targets.

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by