Filter löschen
Filter löschen

plotconfusion cannot produce the correct result as confusionmat

14 Ansichten (letzte 30 Tage)
Haotian Xue
Haotian Xue am 20 Jul. 2020
Beantwortet: Gouri Chennuru am 24 Jul. 2020
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

Antworten (1)

Gouri Chennuru
Gouri Chennuru am 24 Jul. 2020
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!

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by