Bad accuracy in the confusion matrix of neural network

5 visualizaciones (últimos 30 días)
afef
afef el 11 de Jun. de 2017
Editada: orlem lima dos santos el 9 de En. de 2018
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 ?

Respuestas (1)

orlem lima dos santos
orlem lima dos santos el 9 de En. de 2018
Editada: orlem lima dos santos el 9 de En. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by