0
$\begingroup$

Question

Does the AUC metric calculates the area of ROC or PR?

Background

tf.keras.metrics.AUC says:

This value is ultimately returned as auc, an idempotent operation that computes the area under a discretized curve of precision versus recall values (computed using the aforementioned variables).

Therefore, it should be calculating the area under PR, not ROC. However, it also says:

Approximates the AUC (Area under the curve) of the ROC or PR curves

If it calculate the area under PR, then why it says "Approximate ROC or PR" instead of clearly saying "Approximate PR" only without ROC?

Please help understand what I am missing.

$\endgroup$

1 Answer 1

1
$\begingroup$

As defined in the Keras documentation: "Approximates the AUC (Area under the curve) of the ROC or PR curves", it gives you the option to get the Area Under the Curve for both ROC curve or Precission-Recall curve (specially useful for highly unbalanced datasets). The choice of your desired curve can be done vía the 'curve' parameter below:

tf.keras.metrics.AUC(
    num_thresholds=200, curve='ROC',
    summation_method='interpolation', name=None, dtype=None,
    thresholds=None, multi_label=False, num_labels=None, label_weights=None,
    from_logits=False
)
$\endgroup$
3
  • $\begingroup$ Thanks for the reply. So this description "This value is ultimately returned as auc, an idempotent operation that computes the area under a discretized curve of precision versus recall values" should be wrong as it is limiting to PR only? $\endgroup$
    – mon
    Jul 17, 2021 at 11:44
  • $\begingroup$ As far as I can see in the description of the current documentation, and as I also used it several times, it gives you the chance to select the curve type you want, being ROC the default one $\endgroup$
    – German C M
    Jul 17, 2021 at 13:07
  • $\begingroup$ num_thresholds is the threshold that would be the predicted probability of an observation belonging to the positive class. So for binary classification (which is logistic regression) it would be say >0.5. So what value do we use here? What about the summation_method ? Or maybe I'm going about this the wrong way. I just want to access the AUC value that's in the classification report output. $\endgroup$
    – Edison
    Jul 11, 2022 at 14:10

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.