make new indexes and added pfroc
This commit is contained in:
@@ -4,3 +4,4 @@ from .data_utils import *
|
||||
from .cal_froc_from_np import *
|
||||
from .blob_preprocess import *
|
||||
from .analysis_utils import *
|
||||
from .p_auc import *
|
||||
|
25
src/sfransen/FROC/p_auc.py
Executable file
25
src/sfransen/FROC/p_auc.py
Executable file
@@ -0,0 +1,25 @@
|
||||
import numpy as np
|
||||
|
||||
def partial_auc(sensitivity, fp_per_patient, low=0.1, high=2.5):
|
||||
"""
|
||||
Calculates partial area-under-the-curve from FROC sensitivity/FPP curve.
|
||||
"""
|
||||
|
||||
# Remove all values above min and max FPP
|
||||
clipped_sens, clipped_fpp = [0.], [0.]
|
||||
max_sens_before_window = 0
|
||||
max_fpp_before_window = 0
|
||||
for sens, fpp in zip(sensitivity, fp_per_patient):
|
||||
if fpp < low and fpp > max_fpp_before_window:
|
||||
max_sens_before_window = sens
|
||||
|
||||
if fpp >= low and fpp <= high:
|
||||
clipped_sens.append(sens)
|
||||
clipped_fpp.append(fpp)
|
||||
|
||||
# Extend the window to the limits supplied by the user
|
||||
clipped_sens = [max_sens_before_window] + clipped_sens + [clipped_sens[-1]]
|
||||
clipped_fpp = [low] + clipped_fpp + [high]
|
||||
|
||||
# Integrate y(x) with the trapezoid rule
|
||||
return np.trapz(clipped_sens, clipped_fpp)
|
Reference in New Issue
Block a user