I am working on 3 class problem.How to calculate precision,recall ,f-score,MCC of each class while using MATLAB. Here is my confusion matrix:
2775 0 0
1 591 0
4 0 845
I am calculating Accuracy from Confusion matrix in this way:
Accuracyy = 100*sum(diag(confusionMat))./sum(confusionMat(:));
I want to measure below performance measures for each class.I know the formulas but how to execute this in MATLAB. Please help!!! I would really appreciate! Thank you!
Precision=TP / (TP + FP)
Recall= TP / (TP + FN)
F-score = 2*TP /(2*TP+ FP + FN)
Matthews Correlation Coefficient (MCC)