How to calculate Percentage wise confusion matrix for each class??
9 ビュー (過去 30 日間)
古いコメントを表示
I have tried the following command to calculate the confusion matrix
C = confusionmat(testinglabels,predictedLabels)
It gave me the result as shown in the attachment
I want to calculate percentage wise confusion matrix for each class
Please help me
0 件のコメント
回答 (1 件)
Abhipsa
2025 年 2 月 19 日
When using “confusionmat”, the output is given in terms of the number of instances. To express the results as percentages, you can normalize the confusion matrix.
% Normalize the confusion matrix to get percentages
rowSums = sum(C, 2); % Sum of each row
percentageC = (C ./ rowSums) * 100 %this is the result in percentage
Additionally, if you are using MATLAB R2018b or a later version, you can utilise the “confusionchart” function with the “Normalization” name-value pair to achieve this result.
You can read more about “confusionchart” using the follwing MATLAB command:
>> doc confusionchart
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!