0
$\begingroup$

average_precision_score from sklearn uses formula:

ap = sum( (recall[k+1] - recall[k]) * precision[k+1] )

But trapezoidal rule implies:

ap = sum( (recall[k+1] - recall[k]) * (precision[k+1] - precision[k]) / 2 )

This is typical Precision-Recall curve:

enter image description here

We can see, that sklearn average_precision_score would over-estimate AUPRC, and trapezoidal rule is more exact.

However, one argument against trapezoidal rule is

"This implementation is not interpolated and is different from computing the area under the precision-recall curve with the trapezoidal rule, which uses linear interpolation and can be too optimistic"

https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html#sklearn.metrics.average_precision_score

So why not use trapezoidal rule? Is it optimistic or pessimistic?

$\endgroup$

0

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.