Confusion Matrix with known True and Predicted Values

1 次查看(过去 30 天)
I did some machine learning with some datasets. I now have accuracies and numerical numbers of prdicted classes and true classes as shown below:
The different colors (blue, orange, grey, and yellow) show different datasets. The model is pretty accurate, but has some misclassifications. For example take a look at the first row. for the Model(blue), the dataset had 3,505 responsive cells (3392+113), 3392 were correctly identified as responsive but 113 were misclassfied as resistant, making 96.776% accuracy. I want to show either all of the Model(blue) in a confusion matrix with percentages and colors (green for correct, red for incorrect) in a confusion matrix. Or maybe even all the datasets in one matrix. But I'd like to start with one forst to see how it works.
I have tried plotconfusion(), confusionmat(), but I don't think I'm inputting the data correctly.
PLEASE HELP ME.

采纳的回答

Mahesh Taparia
Mahesh Taparia 2021-2-22
Hi
You are already having the class-wise information about the number of correct and misclassified objects, you can use confusionchart function to visualize the confusion matrix. You can refer to this documentation for more information. In your case, a sample example is given below:
A=[3392 113 0 0;125 3397 0 0;0 0 3109 366;0 0 356 3142];
cm = confusionchart(A)
cm.RowSummary = 'row-normalized';
cm.ColumnSummary = 'column-normalized';
Hope it will help!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by