Bad accuracy in the confusion matrix of neural network

조회 수: 5 (최근 30일)
afef
afef 2017년 6월 11일
편집: orlem lima dos santos 2018년 1월 9일
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 ?

답변 (1개)

orlem lima dos santos
orlem lima dos santos 2018년 1월 9일
편집: orlem lima dos santos 2018년 1월 9일
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.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by