Confusion Matrix with known True and Predicted Values

조회 수: 9 (최근 30일)
Elizabeth Cardona
Elizabeth Cardona 2021년 2월 15일
답변: Mahesh Taparia 2021년 2월 22일
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에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by