-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `lesion_TPR_at_FPR` function threw an error when a too-low FPR was requested. Now the function will return a TPR of 0 when the minimum operating point FPR is higher than the requested value.
- Loading branch information
1 parent
4f3ab87
commit 8c93e21
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ def run(self): | |
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
version='1.4.7', # also update version in metrics.py -> version | ||
version='1.4.8', # also update version in metrics.py -> version | ||
author_email='[email protected]', | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import numpy as np | ||
|
||
from picai_eval import Metrics | ||
|
||
|
||
def test_lesion_tpr_at_fpr(): | ||
""" | ||
Test the lesion TPR at FPR function | ||
""" | ||
lesion_results = { | ||
"0": [(0, 1, 1.)], | ||
"1": [(0, 2, 1.)], | ||
"2": [(1, 3, 1.)], | ||
"3": [(1, 1, 1.), (1, 1, 1.)], | ||
"4": [(0, 3, 1.)], | ||
"5": [(1, 2.5, 1.), (1, 1.5, 1.)], | ||
} | ||
metrics = Metrics(lesion_results=lesion_results) | ||
np.testing.assert_allclose(metrics.lesion_TPR, [0.2, 0.4, 0.4, 0.6, 0.6]) | ||
np.testing.assert_allclose(metrics.lesion_FPR, [0.16666667, 0.16666667, 0.33333334, 0.33333334, np.inf]) | ||
|
||
# test with FPR = 0.3 | ||
np.testing.assert_almost_equal(metrics.lesion_TPR_at_FPR(0.3), 0.4) | ||
|
||
# test with too low FPR | ||
np.testing.assert_almost_equal(metrics.lesion_TPR_at_FPR(0.1), 0.0) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_lesion_tpr_at_fpr() |