-1

confusion matrix

I have an issue where I'm trying to compute the test accuracy for a naive classifier that always predicts ^y=−1.

I have already calculated the test accuracy of the classifier based on the confusion matrix attached above by using (TN + TP)/. But how do I calculate the naive value?

accuracy = (109112+3805)/127933

naive_accuracy = # TODO: Compute the accuracy of the naive classifier

filmol
  • 1
  • 1
  • https://medium.com/analytics-vidhya/confusion-matrix-accuracy-precision-recall-f1-score-ade299cf63cd – duffymo Feb 09 '23 at 15:04

1 Answers1

-1

It is actually the same formula. You should just notice that your naive classifier never gives positives answers, so TP = 0. TN will be equal to the total number of negatives: TN = 123324. So naive_accuracy = (TN + TP)/ = (123324 + 0)/127933. And yes, this is the case when naive classifier actually shows better accuracy than the one given by the confusion matrix you are referring to. This is due to data imbalance problem: there are 30 times more negative examples than positive ones. This is why accuracy is not applicable in that setting. Please check out precision, recall and f-score metrics if you need to have a meaningful result.

  • Thanks! I believe that the fact that the naive classifier actually had better accuracy confused me a bit. – filmol Feb 09 '23 at 19:10