|
|
|
|
|
|
|
|
# Integrate area under curve |
|
|
# Integrate area under curve |
|
|
method = 'interp' # methods: 'continuous', 'interp' |
|
|
method = 'interp' # methods: 'continuous', 'interp' |
|
|
if method == 'interp': |
|
|
if method == 'interp': |
|
|
x = np.linspace(0, 1, 1001) # 101-point interp (COCO) |
|
|
|
|
|
|
|
|
x = np.linspace(0, 1, 101) # 101-point interp (COCO) |
|
|
ap = np.trapz(np.interp(x, mrec, mpre), x) # integrate |
|
|
ap = np.trapz(np.interp(x, mrec, mpre), x) # integrate |
|
|
else: # 'continuous' |
|
|
else: # 'continuous' |
|
|
i = np.where(mrec[1:] != mrec[:-1])[0] # points where x axis (recall) changes |
|
|
i = np.where(mrec[1:] != mrec[:-1])[0] # points where x axis (recall) changes |