How do you calculate Precision and Recall using a confusion matrix in Matlab?
I am working on a three class problem. How do you calculate precision, recall, f-score, and MCC for each class while using MATLAB? Here is my confusion matrix:
2775  0    0
1    591   0
4     0   845
I am calculating Accuracy from the Confusion matrix in this way:
Accuracyy = 100*sum(diag(confusionMat))./sum(confusionMat(:));  
I would like to measure the below performance measures for each class. I know the formulas, but not how to execute this in MATLAB. Please help. I would really appreciate it. Thank you.
- $Precision = {{TP} \over {TP \ + \ FP}}$ 
- $Recall = {{TP} \over {TP \ + \ FN}}$ 
- $F-score = {{2 \ * \ TP} \over {2 \ * \ TP \ + FP \ + \ FN}}$ 
- Matthews Correlation Coefficient (MCC) 
Topic multilabel-classification matlab confusion-matrix classification
Category Data Science