Confusion Matrix with known True and Predicted Values

2 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Mahesh Taparia
Mahesh Taparia el 22 de Feb. de 2021
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!

Más respuestas (0)

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by