6
$\begingroup$

My apologies in advance if I am skipping some basics. But I know the formula and understanding of how to calculate accuracy, precision and recall. My question is, given the accuracy, can we validate it using precision (P) and recall (R)? Is there some way that if I have the output of P and R, can I calculate/validate accuracy?

Kindly guide.

$\endgroup$

3 Answers 3

5
$\begingroup$

Assuming we know the sample size $N$ we can get the Accuracy from knowing Precision and Recall. Precision is defined as $\frac{TP}{TP+FP}$ and Recall is defined as $\frac{TP}{TP+FN}$, $TP$ is the number of True Positives, $FP$ is the number of False Positives and $FN$ is the number of True Negatives. Now given that $N = TP+TN+FP+FN$ the only thing we do not know if the number of $TN$. We can solve for $TN = N-(TP+FP+FN)$, given that we can calculate the Accuracy as $\frac{TP+TN}{N}$. If we do not know that total number of samples examined, $N$, then we are stuck.

In general, Precision and Recall (and their harmonic mean, the $F_1$ score) are intuitive measurements indeed but they do not account for the correct classification of negative examples (True Negatives) and that is on certain occasions inconvenient (or outright misleading).

$\endgroup$
0
3
$\begingroup$

No, because you know nothing about true negatives, $TN$. Think about the confusion matrix with $FN,FP,TP$ entries known, which are used to calculate precision and recall, which means you have more information than precision/recall. But, even with these three known, you can adjust $TN$ as much as you can to change the accuracy.

$\endgroup$
0
1
$\begingroup$

No, it's not possible to calculate the accuracy solely based on Precision and Recall. Building up on the previous answers, even if you know the sample size $N$, you'd still need more information.

Given that:

  • $N = TP+TN+FP+FN \implies TN = N-(TP+FP+FN)$
  • Precision is defined as $P = \frac{TP}{TP+FP}$
  • Recall is defined as $R = \frac{TP}{TP+FN}$
  • Accuracy is defined as $Acc = \frac{TN+TP}{N}$

We have:

$Acc = \frac{TN+TP}{N} = \frac{N-(TP+FP+FN)+TP}{N}=\frac{N-FP-FN}{N}$

In order to continue, we would need to have $FP$ and $FN$, or simply $TP$. We can obtain $FP = \frac{TP \cdot (1-P)}{P}$ from the Precision definition, and $FN = \frac{TP \cdot (1-R)}{R}$ from the Recall definition. But without knowing the value of $TP$, we cannot reach a solution.

$\endgroup$
2
  • 1
    $\begingroup$ I think there should be a correction: P = TP/(TP+FP) $\endgroup$ Commented Jul 26, 2023 at 20:47
  • $\begingroup$ @MasoudCharkhabi that's true. I've edited the answer. Thank you! $\endgroup$
    – nicolezk
    Commented Jul 27, 2023 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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