Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
medai
software
mednet
Commits
eff1554d
Commit
eff1554d
authored
1 year ago
by
Daniel CARRON
Committed by
André Anjos
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Evaluation table shows if threshold chosen a priori or posteriori
parent
b82e7485
No related branches found
No related tags found
1 merge request
!6
Making use of LightningDataModule and simplification of data loading
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ptbench/engine/evaluator.py
+14
-9
14 additions, 9 deletions
src/ptbench/engine/evaluator.py
src/ptbench/scripts/evaluate.py
+6
-3
6 additions, 3 deletions
src/ptbench/scripts/evaluate.py
src/ptbench/utils/table.py
+2
-0
2 additions, 0 deletions
src/ptbench/utils/table.py
with
22 additions
and
12 deletions
src/ptbench/engine/evaluator.py
+
14
−
9
View file @
eff1554d
...
...
@@ -48,7 +48,7 @@ def eer_threshold(neg: Iterable[float], pos: Iterable[float]) -> float:
fpr
,
tpr
,
thresholds
=
metrics
.
roc_curve
(
y_true
,
y_predictions
,
pos_label
=
1
)
eer
=
brentq
(
lambda
x
:
1.0
-
x
-
interp1d
(
fpr
,
tpr
)(
x
),
0.0
,
1.0
)
return
interp1d
(
fpr
,
thresholds
)(
eer
)
return
float
(
interp1d
(
fpr
,
thresholds
)(
eer
)
)
def
posneg
(
...
...
@@ -198,12 +198,11 @@ def run(
---------
name:
the local name of this dataset (e.g. ``train``, or ``test``), to be
used when saving measures files.
The name of subset to load.
predictions_folder:
f
older where predictions for the dataset images has been previously
stored
F
older where predictions for the dataset images has been previously
stored
.
f1_thresh:
This number should come from
...
...
@@ -224,11 +223,17 @@ def run(
Returns
-------
maxf1_threshold : float
Th
reshold to achieve the highest possible F1-score for this data
set
pred_data:
Th
e loaded predictions for the specified sub
set
.
post_eer_threshold : float
Threshold achieving Equal Error Rate for this dataset
fig_scores:
Figure of the histogram distributions of true-positive/true-negative scores.
maxf1_threshold:
Threshold to achieve the highest possible F1-score for this dataset.
post_eer_threshold:
Threshold achieving Equal Error Rate for this dataset.
"""
predictions_path
=
os
.
path
.
join
(
predictions_folder
,
f
"
{
name
}
.csv
"
)
...
...
This diff is collapsed.
Click to expand it.
src/ptbench/scripts/evaluate.py
+
6
−
3
View file @
eff1554d
...
...
@@ -224,9 +224,12 @@ def evaluate(
for
subset_name
in
dataloader
.
keys
():
data
[
subset_name
]
=
{
"
df
"
:
results_dict
[
"
pred_data
"
][
subset_name
],
"
threshold
"
:
results_dict
[
"
post_eer_threshold
"
][
# type: ignore
threshold
].
item
(),
"
threshold
"
:
results_dict
[
"
post_eer_threshold
"
][
threshold
]
if
isinstance
(
threshold
,
str
)
else
eer_threshold
,
"
threshold_type
"
:
f
"
posteriori [
{
threshold
}
]
"
if
isinstance
(
threshold
,
str
)
else
"
priori
"
,
}
output_figure
=
os
.
path
.
join
(
output_folder
,
"
plots.pdf
"
)
...
...
This diff is collapsed.
Click to expand it.
src/ptbench/utils/table.py
+
2
−
0
View file @
eff1554d
...
...
@@ -47,6 +47,7 @@ def performance_table(data, fmt):
headers
=
[
"
Dataset
"
,
"
T
"
,
"
T Type
"
,
"
F1 (95% CI)
"
,
"
Prec (95% CI)
"
,
"
Recall/Sen (95% CI)
"
,
...
...
@@ -61,6 +62,7 @@ def performance_table(data, fmt):
entry
=
[
k
,
v
[
"
threshold
"
],
v
[
"
threshold_type
"
],
]
df
=
v
[
"
df
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment