confMatPlot

Display the confusion matrix

Contents

Syntax

Description

confMatPlot(confMat) plots the confusion matrix of classification result.

confMatPlot(confMat, opt) labels the class names along the confusion matrix.

Example

desired=[1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5];
computed=[1 5 5 1 1 1 1 1 5 5 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 2 5 5 5 5 5 5 5 5 3 5 5 5];
confMat = confMatGet(desired, computed);
opt=confMatPlot('defaultOpt');
opt.className={'Canada', 'China', 'Japan', 'Taiwan', 'US'};
% === Example 1: Data count plot
opt.mode='dataCount';
figure; confMatPlot(confMat, opt);
% === Example 2: Percentage plot
opt.mode='percentage';
opt.format='8.2f';
figure; confMatPlot(confMat, opt);
% === Example 3: Plot of both data count and percentage
opt.mode='both';
figure; confMatPlot(confMat, opt);

See Also

confMatGet.


Top page   Next: confMatGet.m   Prev:crossValidate.m