Skip to content
EvalSuite
Documentation menu

Classification

PR AUC (average precision)

Implementedclassification.pr_auc

Definition

Summary of the precision-recall curve, computed as average precision over recall steps.

Formula

AP = Σₙ (Rₙ − Rₙ₋₁) · Pₙ

Range: [0, 1]

Inputs and outputs

  • y_true: array of binary labels {0, 1}
  • y_prob: predicted probability of the positive class in [0, 1]

Returns: float

Assumptions

No assumptions beyond valid, aligned inputs of the documented types.

Limitations

  • The baseline equals prevalence, so values are not comparable across datasets with different prevalence.
  • Trapezoidal interpolation of PR curves is optimistic; average precision avoids it.

Python API

PythonSince v0.1.0
import evalsuite as es

es.average_precision(y_true, y_prob)

References

  1. Davis, J., & Goadrich, M. (2006). The relationship between precision-recall and ROC curves. Proceedings of the 23rd International Conference on Machine Learning, 233–240.
  2. Saito, T., & Rehmsmeier, M. (2015). The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PLOS ONE, 10(3), e0118432.

Implementation status