CalcWorldHub
Free online calculator · no signup

Average precision from binary scores calculator

Compute noninterpolated average precision from a precision–recall threshold sweep.

4,000 tools
Average precision from binary scores calculator — Prediction scores, True binary labels and calculation method
Average precision from binary scores calculator: inputs and calculation method.

How to use this calculator

Compute noninterpolated average precision from a precision–recall threshold sweep.

  1. Enter Prediction scores, True binary labels. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

Average precision from binary scores explained

Rank the scored items, record precision at each relevant item, and average those precisions for one binary-label query.

Noninterpolated average precision0.8333
Noninterpolated average precision: 0.83333333 in the worked scenario.

How the calculation works

Sum of recall increments times threshold precision

Scores determine ranking; binary labels determine which ranks contribute to average precision. Scores are grouped at ties; at least one positive item is required.

Inputs and units

s — Prediction scores
Prediction scores. Use comma-separated values in the stated order.
y — True binary labels
True binary labels. Use comma-separated values in the stated order.

Limits of this model

Scores are grouped at ties; at least one positive item is required. This is not trapezoidal PR area.

Check this example

Prediction scores = 0.1, 0.4, 0.35, 0.8; True binary labels = 0, 0, 1, 1.

  • Noninterpolated average precision: 0.83333333

For scores 0.1, 0.4, 0.35, 0.8 with labels 0, 0, 1, 1, descending order is relevant, nonrelevant, relevant, nonrelevant. AP = (1 + 2/3) / 2 = 0.833333.

Frequently asked questions

Does it equal ROC AUC?

No, precision–recall evaluation weights class imbalance differently.

Are ties broken arbitrarily?

No, equal scores enter together.

Does a zero-positive sample work?

Average precision is undefined here and rejected.

How do I use the Average precision from binary scores calculator?

Enter Prediction scores, True binary labels. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Average precision from binary scores?

Prediction scores = 0.1, 0.4, 0.35, 0.8; True binary labels = 0, 0, 1, 1. Noninterpolated average precision: 0.83333333 For scores 0.1, 0.4, 0.35, 0.8 with labels 0, 0, 1, 1, descending order is relevant, nonrelevant, relevant, nonrelevant. AP = (1 + 2/3) / 2 = 0.833333 .

Sources