1
$\begingroup$

I am given the following metrics for a certain classifier : -Total number of cases in the dataset = 110 -Accuracy: 92.7% -Precision : 96.9% -Recall : 95%

Are this information enough to reconstruct the confusion matrix?

$\endgroup$
1
$\begingroup$

[edit thanks to comment] I'm assuming this is a binary classifier, since normally a multi-class classifier would not be evaluated with precision/recall (it would require micro/macro precision/recall).

Yes, that should be enough:

  • accuracy = 92.7%:

$$\frac{TP+TN}{110}=0.927 \rightarrow TP+TN=101.97$$

This means we have 102 correct predictions, so $FP+FN= 8$ incorrect predictions (since $TP+FP+TN+FN=110$).

  • precision = 96.9%:

$$\frac{TP}{TP+FP}=0.969 \rightarrow TP=31.258\times FP$$

  • recall = 95%:

$$\frac{TP}{TP+FN}=0.950 \rightarrow TP=19 \times FN$$

This gives us:

$$\frac{TP}{31.258}+\frac{TP}{19}=8 \rightarrow TP = 94.6$$

let's assume that means 95 true positive instances, so we get:

  • $FP = 3$
  • $FN = 5$
  • $TN = 7$
|improve this answer|||||
$\endgroup$
  • 1
    $\begingroup$ This will only work for binary classifier. For multi-class just metrics are not enough. $\endgroup$ – Piotr Rarus - Reinstate Monica Dec 17 '19 at 11:25
  • $\begingroup$ @PiotrRarus-ReinstateMonica good point, I added it in my answer $\endgroup$ – Erwan Dec 17 '19 at 11:58
  • $\begingroup$ in addition to micro/macro modes there's also weighted mode. $\endgroup$ – Piotr Rarus - Reinstate Monica Dec 17 '19 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.