How to plot a confusion matrix for multi-class categorical labels?

조회 수: 13 (최근 30일)
Sidhant Sundrani
Sidhant Sundrani 2018년 2월 28일
답변: Keith Hautala 2018년 3월 16일
I have 17 classes. Targets and outputs are of categorical type (example 'dog', 'cat'). They are N x 1 vectors where N is the number of samples.
How do I plot a confusion matrix for this? I don't think I can use the built in function, 'Plotconfusion(targets,outputs)' because requires the targets and outputs to be matrices.

답변 (2개)

Greg Heath
Greg Heath 2018년 3월 7일
Convert the categorical labels to a binary equivalent.

Keith Hautala
Keith Hautala 2018년 3월 16일
1) Change the categories of both targets and outputs using grp2idx or double.
2) Transpose the results of (1)
3) Use the result of (2) as the targets and outputs as described here: https://www.mathworks.com/matlabcentral/answers/338244-how-can-i-plot-a-confusion-matrix-for-a-multi-class-or-non-binary-classification-problem

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by