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"


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



Your Answer

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