필터 지우기
필터 지우기

Neural Network Plotting Confusion Matrix

조회 수: 2 (최근 30일)
protosta
protosta 2013년 6월 21일
Hi, i am currently using the neural network with Matlab and i want to plot a confusion matrix for the training, validation and testing stage. When i implement the confusion matrix with the code figure, plotconfusion(targets,outputs) - i only get the overall confusion matrix please can any one help me with this. Here is my full code.
inputs = totalnew;
targets = targetnew;
% Create a Pattern Recognition Network
hiddenLayerSize = 20;
net = patternnet(hiddenLayerSize);
% Choose Input and Output Pre/Post-Processing Functions
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
% Setup Division of Data for Training, Validation, Testing
net.divideFcn = 'divideind';
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainInd = 1:700;
net.divideParam.valInd = 701:850;
net.divideParam.testInd = 851:1000;
net.trainFcn = 'trainlm'; % Levenberg-Marquardt
net.performFcn = 'mse'; % Mean squared error
% Choose Plot Functions
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ... 'plotregression', 'plotfit'};
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
% Recalculate Training, Validation and Test Performance
trainTargets = targets .* tr.trainMask{1};
valTargets = targets .* tr.valMask{1};
testTargets = targets .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,outputs)
valPerformance = perform(net,valTargets,outputs)
testPerformance = perform(net,testTargets,outputs)
% View the Network
view(net)
% Plots
figure, plotconfusion(targets,outputs)
Please Help If You Can

채택된 답변

Greg Heath
Greg Heath 2013년 7월 1일
Click on the plotconfusion button in the nntraintool window.
You have specified many net properties that are already defaults
... a waste of time and space.
Thank you for formally accepting my answer
Greg

추가 답변 (0개)

카테고리

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