Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
journal_eiv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Jörg Martin
journal_eiv
Commits
d88c989f
Commit
d88c989f
authored
3 years ago
by
Jörg Martin
Browse files
Options
Downloads
Patches
Plain Diff
plot_summary added
parent
cbcab5fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Experiments/plot_summary.py
+168
-1
168 additions, 1 deletion
Experiments/plot_summary.py
with
168 additions
and
1 deletion
Experiments/plot_summary.py
+
168
−
1
View file @
d88c989f
...
@@ -9,5 +9,172 @@ import os
...
@@ -9,5 +9,172 @@ import os
import
glob
import
glob
import
json
import
json
import
numpy
as
np
import
matplotlib.pyplot
as
plt
## include evaluate_metrics content here and adapt
k
=
2
# load in all available result files
list_of_result_files
=
glob
.
glob
(
os
.
path
.
join
(
'
results
'
,
'
*.json
'
))
results
=
{}
for
filename
in
list_of_result_files
:
data
=
filename
.
replace
(
os
.
path
.
join
(
'
results
'
,
'
metrics_
'
),
''
).
replace
(
'
.json
'
,
''
)
with
open
(
filename
,
'
r
'
)
as
f
:
results
[
data
]
=
json
.
load
(
f
)
def
save_readout
(
dictionary
,
key
):
"""
Returns the value of the `dictionary` for `key`, unless
the later doesn
'
t exist, in which case (None,None) is returned.
"""
try
:
readout
=
dictionary
[
key
]
if
type
(
readout
)
is
list
:
assert
len
(
readout
)
==
2
return
readout
else
:
readout
=
float
(
readout
)
return
(
readout
,
None
)
except
KeyError
:
return
(
None
,
None
)
## RMSE plot
metric
=
'
rmse
'
data_list
=
results
.
keys
()
colors
=
[
'
red
'
,
'
blue
'
]
ymax
=
0.8
# read out EiV and non-EiV results for all datasets
metric_results
=
[
(
save_readout
(
results
[
data
][
'
eiv
'
],
metric
),
save_readout
(
results
[
data
][
'
noneiv
'
],
metric
))
for
data
in
data_list
]
# create figure
plt
.
figure
(
1
)
plt
.
clf
()
plt
.
title
(
'
RMSE
'
)
# plot bars
for
i
,
([(
eiv_metric_mean
,
eiv_metric_std
),
(
noneiv_metric_mean
,
noneiv_metric_std
)],
\
data
)
in
\
enumerate
(
zip
(
metric_results
,
data_list
)):
if
eiv_metric_mean
is
not
None
:
assert
noneiv_metric_mean
is
not
None
if
eiv_metric_std
is
not
None
:
assert
noneiv_metric_std
is
not
None
plt
.
plot
(
i
+
1
,
eiv_metric_mean
,
'
^
'
,
color
=
colors
[
0
])
plt
.
bar
(
i
+
1
,
height
=
2
*
eiv_metric_std
,
width
=
0.1
,
bottom
=
eiv_metric_mean
-
eiv_metric_std
,
color
=
colors
[
0
],
alpha
=
0.5
)
plt
.
plot
(
i
+
1
,
noneiv_metric_mean
,
'
^
'
,
color
=
colors
[
1
])
plt
.
bar
(
i
+
1
,
height
=
2
*
k
*
noneiv_metric_std
,
width
=
0.1
,
bottom
=
noneiv_metric_mean
-
k
*
noneiv_metric_std
,
color
=
colors
[
1
],
alpha
=
0.5
)
plt
.
ylim
(
bottom
=
0
,
top
=
y_max
)
ax
=
plt
.
gca
()
ax
.
set_xticks
(
np
.
arange
(
1
,
len
(
data_list
)
+
1
))
ax
.
set_xticklabels
(
data_list
,
rotation
=
'
vertical
'
)
plt
.
savefig
(
'
results/figures/RMSE_bar_plot.pdf
'
)
## coverage plot
metric
=
'
true_coverage_numerical
'
data_list
=
[
'
linear
'
,
'
quadratic
'
,
'
cubic
'
,
'
sine
'
]
colors
=
[
'
red
'
,
'
blue
'
]
ymax
=
1.0
# read out EiV and non-EiV results for all datasets
metric_results
=
[
(
save_readout
(
results
[
data
][
'
eiv
'
],
metric
),
save_readout
(
results
[
data
][
'
noneiv
'
],
metric
))
for
data
in
data_list
]
# create figure
plt
.
figure
(
2
)
plt
.
clf
()
plt
.
title
(
'
coverage (ground truth)
'
)
# plot bars
for
i
,
([(
eiv_metric_mean
,
eiv_metric_std
),
(
noneiv_metric_mean
,
noneiv_metric_std
)],
\
data
)
in
\
enumerate
(
zip
(
metric_results
,
data_list
)):
if
eiv_metric_mean
is
not
None
:
assert
noneiv_metric_mean
is
not
None
if
eiv_metric_std
is
not
None
:
assert
noneiv_metric_std
is
not
None
plt
.
plot
(
i
+
1
,
eiv_metric_mean
,
'
^
'
,
color
=
colors
[
0
])
plt
.
bar
(
i
+
1
,
height
=
2
*
eiv_metric_std
,
width
=
0.1
,
bottom
=
eiv_metric_mean
-
eiv_metric_std
,
color
=
colors
[
0
],
alpha
=
0.5
)
plt
.
plot
(
i
+
1
,
noneiv_metric_mean
,
'
^
'
,
color
=
colors
[
1
])
plt
.
bar
(
i
+
1
,
height
=
2
*
k
*
noneiv_metric_std
,
width
=
0.1
,
bottom
=
noneiv_metric_mean
-
k
*
noneiv_metric_std
,
color
=
colors
[
1
],
alpha
=
0.5
)
plt
.
axhline
(
0.95
,
0.0
,
1.0
,
color
=
'
k
'
,
linestyle
=
'
dashed
'
)
plt
.
ylim
(
bottom
=
0
,
top
=
y_max
)
ax
=
plt
.
gca
()
ax
.
set_xticks
(
np
.
arange
(
1
,
len
(
data_list
)
+
1
))
ax
.
set_xticklabels
(
data_list
,
rotation
=
'
vertical
'
)
plt
.
savefig
(
'
results/figures/true_coverage_bar_plot.pdf
'
)
## noisy coverage plot
metric
=
'
coverage_numerical
'
data_list
=
results
.
keys
()
colors
=
[
'
red
'
,
'
blue
'
]
ymax
=
1.0
# read out EiV and non-EiV results for all datasets
metric_results
=
[
(
save_readout
(
results
[
data
][
'
eiv
'
],
metric
),
save_readout
(
results
[
data
][
'
noneiv
'
],
metric
))
for
data
in
data_list
]
# create figure
plt
.
figure
(
3
)
plt
.
clf
()
plt
.
title
(
'
coverage (noisy labels)
'
)
# plot bars
for
i
,
([(
eiv_metric_mean
,
eiv_metric_std
),
(
noneiv_metric_mean
,
noneiv_metric_std
)],
\
data
)
in
\
enumerate
(
zip
(
metric_results
,
data_list
)):
if
eiv_metric_mean
is
not
None
:
assert
noneiv_metric_mean
is
not
None
if
eiv_metric_std
is
not
None
:
assert
noneiv_metric_std
is
not
None
plt
.
plot
(
i
+
1
,
eiv_metric_mean
,
'
^
'
,
color
=
colors
[
0
])
plt
.
bar
(
i
+
1
,
height
=
2
*
eiv_metric_std
,
width
=
0.1
,
bottom
=
eiv_metric_mean
-
eiv_metric_std
,
color
=
colors
[
0
],
alpha
=
0.5
)
plt
.
plot
(
i
+
1
,
noneiv_metric_mean
,
'
^
'
,
color
=
colors
[
1
])
plt
.
bar
(
i
+
1
,
height
=
2
*
k
*
noneiv_metric_std
,
width
=
0.1
,
bottom
=
noneiv_metric_mean
-
k
*
noneiv_metric_std
,
color
=
colors
[
1
],
alpha
=
0.5
)
plt
.
ylim
(
bottom
=
0
,
top
=
y_max
)
ax
=
plt
.
gca
()
ax
.
set_xticks
(
np
.
arange
(
1
,
len
(
data_list
)
+
1
))
ax
.
set_xticklabels
(
data_list
,
rotation
=
'
vertical
'
)
plt
.
savefig
(
'
results/figures/noisy_coverage_bar_plot.pdf
'
)
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