How to display Confusion matrix of Testing ,Training and Validation without using nprtool
4 views (last 30 days)
Show older comments
Hello Everyone ,
I want to display confusion matrix of Testing , Training and validation through code .
plotConfusion(Target, Output) only displays the overall confusion matrix .
i can only show the three matrices first time i train the network using newpr. How to display them again ?
0 Comments
Accepted Answer
Greg Heath
on 19 Jun 2012
net = patternnet(x,t,H); [net tr ] = train(net,x,t);
The training record in the structure tr contains the indices for the trn/val/tst subsets.
Therefore, they can be used to obtain separate performance results.
Hope this helps.
Greg
3 Comments
Rina Blomberg
on 25 Mar 2015
% x = inputs, t = targets, y = outputs
% Train the Network
[net, tr] = train(net, x, t);
% Training Confusion Plot Variables
yTrn = net(x(:,tr.trainInd));
tTrn = t(:,tr.trainInd);
% Validation Confusion Plot Variables
yVal = net(x(:,tr.valInd));
tVal = t(:,tr.valInd);
% Test Confusion Plot Variables
yTst = net(x(:,tr.testInd));
tTst = t(:,tr.testInd);
% Overall Confusion Plot Variables
yAll = net(x);
tAll = t;
% Plot Confusion
plotconfusion(tTrn, yTrn, 'Training', tVal, yVal, 'Validation', tTst, yTst, 'Test', tAll, yAll, 'Overall')
Supriya Pahwa
on 6 Aug 2015
yTst = net(x(:,tr.testInd)) when i use this command, i get an error. Subscript indices must either be real positive integers or logicals.
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!