0

The total number of data points for which the following binary classification result is obtained = 1500. Out of which, I have

  • 1473 labelled as 0 and
  • the remaining 27 as 1 .

As can be seen from the confusion matrix, out of 27 data points belonging to class 1, I got only 1 data point misclassified as 0 . So, I calculated the accuracy for individual classes and got Accuracy for class labelled as 0 = 98.2% and for the other as 1.7333%. Is this calculation correct? I am not sure...I did get a pretty good classification for the class labelled as 1 so why the accuracy for it is low? The individual class accuracies should have been 100% for class0 and around 98% for class1

Does one misclassification reduce the accuracy of class 1 by so much amount? This is the how I calculated the individual class accuracies in MAtlab.

cmMatrix  = 
1473    0
1       26

acc_class0  = 100*(cmMatrix(1,1))/1500;
acc_class1= 100*(cmMatrix(2,2))/1500;
Srishti M
  • 533
  • 4
  • 21
  • Your computation is not correct. [This section on Wikipedia](https://en.wikipedia.org/wiki/Precision_and_recall#Definition_(classification_context)) has a good overview of the various error measures and how to compute them. – Cris Luengo Jul 10 '18 at 02:31

1 Answers1

3

If everything had been classified correctly, your computation would indicate accuracy for class 1 as 27/1500=0.018. This is obviously wrong. Overall accuracy is 1499/1500, but per-class accuracy cannot use 1500 as denominator. 27 is the maximum correctly classified elements, and should therefore be the denominator.

acc_class0 = 100*cmMatrix(1,1)/sum(cmMatrix(1,:));
acc_class1 = 100*cmMatrix(2,2)/sum(cmMatrix(2,:));
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120