1
$\begingroup$

A quick overview of definitions before I get into the question:

  • True Positive (TP): An actual positive that the model classified as positive

  • False Positive (FP): An actual negative that the model classified as positive

  • False Negative (FN): An actual positive that the model classified as negative

  • Recall (True Positive Rate, TPR): $\frac{TP}{TP + FN}$

  • Precision: $\frac{TP}{TP + FP}$

  • Logistic Threshold: A probability above which a sample is classified as positive and below which is classified as negative. It is the grey line in the figure: enter image description here

  • Confusion Matrix: Summary of classification results

  • Steps to generating Precision-Recall curve: 1.) Choose a threshold. 2.) Generate confusion matrix. 3.) Calculate the TPR and Precision from confusion matrix and plot the point

  • Example of Precision-Recall curve:

enter image description here

We can see from this example that the precision is 1 when the recall is 0. I find this confusing...


My question:

Let's say we choose a threshold of 1. Thus, all the samples will be classified as negatives. Thus there will be no true positives, no false positives, and likely a bunch of false negatives.

The calculated recall (TPR) would be: $\frac{0}{0 + FN} = 0$

The calculated precision would be: $\frac{0}{0 + 0} = \frac{0}{0}$

So how come the precision-recall curves I see have precision = 1 when recall (TPR) = 0?

$\endgroup$

1 Answer 1

0
$\begingroup$

You can't divide by zero, so precision is undefined. It's a pathological case, so it doesn't return meaningful results.

$\endgroup$
1
  • $\begingroup$ The logistic regression model is a probability model. What you are doing is inappropriate for this model. $\endgroup$ Apr 18, 2022 at 11:15

Your Answer

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

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