2 views

Using the below precision recall graph where recall is on x-axis and precision is on y-axis can I use this formula to calculate the number of predictions for a given precision, recall threshold ? These calculations are based on orange trend line.

Assuming this model has been trained on 100 instances and is a binary classifier.

At recall value 0.2 there (0.2 * 100) = 20 relevant instances. At recall value 0.2 the precision = .95 so the number of true positives (20 * .95) = 19. Is this a correct method to calculate the number of true positives from precision-recall graph ?

by (41.4k points)

Here, we should take 100 observations,a recall of 20%, and precision of 90% for making the calculations easy.

So, to produce those numbers here are two result matrices.

TP/TN->Test positive/Test Negative

CP/CN->Condition Positive/Condition Negative

CP   CN

TP    9    1

TN    36  54

and

CP   CN

TP    18    2

TN    72    8

Matrix 1:

TP= 9

FP = 1 and FN= 36

This results  in a recall of 9 / (36 + 9) = 20%

and a precision of 9 / (1 + 9) = 90%

Matrix 2

TP = 18

FP = 2 and FN = 72

This results in a recall of 18 / (72 + 18) = 20%

and a precision of 18 / (2+18) = 90%

The graph does not give enough information to trace back the TP because two matrices with different TP and the same recall + precision can be made.

If you wish to learn more about how to use python for data science, then go through data science python programming course by Intellipaat for more insights.