How to calculate Percentage wise confusion matrix for each class??
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Abhipsa
el 19 de Feb. de 2025
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 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!