plotconfusion cannot produce the correct result as confusionmat
1 次查看(过去 30 天)
显示 更早的评论
Hello
I have two column vectors A and B. A is the label, (1 2 3 4 represents the class). B is the predict value. when i use following command to get the confusion matrix, it is ok, i get a 4*4 confusion matrix. But the result of plotconfusion(A,B) : i get a 14 * 14 matrix plot and all the values in the plot is 0%. and there is an warning " Targets were not all 1/0 values and have been rounded. "
I dont understand why command plotconfusion has totally different results from command confusionmat.
A = [1;2;3;4;1;1;2;3;4;1;1;2;2;3];
B = [1;2;3;3;2;1;2;3;4;1;4;2;2;3];
C =confusionmat (A,B);
plotconfusion(A,B);
pls help
thanks
0 个评论
回答(1 个)
Gouri Chennuru
2020-7-24
Hi Haotian,
As per my understanding, you have given the same sort of inputs to the confusionmat function and plotconfusion function.
Confusionmat function takes input as known groups and predicted groups and returns the confusion matrix,
Whereas plotconfusion function plots a confusion matrix for the true labels targets and predicted labels outputs.
As a workaround you can plot the confusion matrix using confusionchart.
Execute the code and you will get the results as expected.
A = [1;2;3;4;1;1;2;3;4;1;1;2;2;3];
B = [1;2;3;3;2;1;2;3;4;1;4;2;2;3];
C =confusionmat (A,B);
confusionchart(C); % to plot the confusion matrix
Hope this Helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!