Skip to content

Commit

Permalink
Implement lesion_TPR_at_FPR (#14)
Browse files Browse the repository at this point in the history
Calculate the lesion-level true positive rate (sensitivity) at a given false positive rate (average number of false positives per examimation)
  • Loading branch information
joeranbosma authored Jun 22, 2023
1 parent 32d97e9 commit 9d0318c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/picai_eval/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ def score(self):
"""Calculate the ranking score, as used in the PI-CAI 22 Grand Challenge"""
return (self.auroc + self.AP) / 2

def lesion_TPR_at_FPR(self, FPR: float) -> float:
"""Calculate the lesion-level true positive rate (sensitivity) at a given
false positive rate (average number of false positives per examimation)"""
if np.max(self.lesion_FPR) < FPR:
return 0
return self.lesion_TPR[self.lesion_FPR <= FPR][-1]

# lesion-level results
def get_lesion_results_flat(self, subject_list: Optional[List[str]] = None):
"""Flatten the per-case lesion evaluation results into a single list"""
Expand Down

0 comments on commit 9d0318c

Please sign in to comment.