# Constructing the Confusion matrix from given metrics

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?

[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$$
• This will only work for binary classifier. For multi-class just metrics are not enough. – Piotr Rarus - Reinstate Monica Dec 17 '19 at 11:25
• @PiotrRarus-ReinstateMonica good point, I added it in my answer – Erwan Dec 17 '19 at 11:58
• in addition to micro/macro modes there's also weighted mode. – Piotr Rarus - Reinstate Monica Dec 17 '19 at 13:28