All problems
11-Point Interpolated AP
Problem
Compute the 11-point interpolated average precision (VOC 2007 style) from score-ordered labels.
For recall levels 0.0, 0.1, ..., 1.0 take the maximum precision achieved at a recall of at least that level; labels[k] is 1 for a positive and 0 otherwise, already sorted by descending score. Return the mean of the 11 values rounded to 4 decimal places, or 0.0 when there are no positives.
Test cases
case 1
in: [[1,0,1,1,0]]
expected: 0.8409
case 2
in: [[0,0,0]]
expected: 0
case 3
in: [[1,1,0,0,1]]
expected: 0.8545
case 4
in: [[1]]
expected: 1
Starter codePython
def ap_11_point(labels):
# Your code here
pass4 test cases · run your code against them in the editor