Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VOB
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
Container Registry
Model registry
Operate
Environments
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
Petra Gospodnetic
VOB
Commits
4f76cd4b
Commit
4f76cd4b
authored
4 years ago
by
gospodnetic
Browse files
Options
Downloads
Patches
Plain Diff
Generate LaTex result table
parent
a4114392
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Benchmark.py
+75
-0
75 additions, 0 deletions
Benchmark.py
LogContainer.py
+12
-0
12 additions, 0 deletions
LogContainer.py
utilities.py
+4
-0
4 additions, 0 deletions
utilities.py
vob.py
+14
-8
14 additions, 8 deletions
vob.py
with
105 additions
and
8 deletions
Benchmark.py
0 → 100644
+
75
−
0
View file @
4f76cd4b
import
utilities
as
util
class
Benchmark
:
def
__init__
(
self
):
self
.
log_container_per_model
=
{}
self
.
methods_per_approach
=
{}
def
set_log_containers
(
self
,
log_container_per_model
):
self
.
log_container_per_model
=
log_container_per_model
self
.
__extract_methods_per_approach
()
def
__extract_methods_per_approach
(
self
):
for
model
in
self
.
log_container_per_model
:
for
approach
in
self
.
log_container_per_model
[
model
].
methods_per_approach
:
for
method
in
self
.
log_container_per_model
[
model
].
methods_per_approach
[
approach
]:
if
approach
in
self
.
methods_per_approach
:
if
method
not
in
self
.
methods_per_approach
[
approach
]:
self
.
methods_per_approach
[
approach
].
append
(
method
)
else
:
self
.
methods_per_approach
[
approach
]
=
[
method
]
def
generate_tex_table
(
self
):
tex_file
=
open
(
"
performance_table.tex
"
,
"
w
"
)
tex_file
.
write
(
"
\n\\
begin{table*}
\n
"
)
tex_file
.
write
(
"
\\
begin{tabular}{|c| c|
"
)
for
model
in
self
.
log_container_per_model
:
tex_file
.
write
(
"
c c c c|
"
)
tex_file
.
write
(
"
}
\n
"
)
tex_file
.
write
(
"
\\
hline
\n
"
)
# Header - model names
tex_file
.
write
(
"
\\
multicolumn{2}{|c|}{}
"
)
# Put models into array to ensure the order is always maintained.
models
=
[]
for
model
in
self
.
log_container_per_model
:
tex_file
.
write
(
"
&
\\
multicolumn{{4}}{{|c|}}{{{}}}
"
.
format
(
model
))
models
.
append
(
model
)
tex_file
.
write
(
"
\\\\\n
"
)
# Header - column names
tex_file
.
write
(
"
\\
hline
\n
"
)
tex_file
.
write
(
"
Approach & Method
"
)
for
model
in
models
:
tex_file
.
write
(
"
&
\\
#VPC &
\\
makecell{
\\
#VPC
\\\\
used} &
\\
#OVP &
\\
%
"
)
tex_file
.
write
(
"
\\\\\n
"
)
for
approach
in
self
.
methods_per_approach
:
method_count
=
len
(
self
.
methods_per_approach
[
approach
])
tex_file
.
write
(
"
\n\\
hline
\n
"
)
tex_file
.
write
(
"
\\
multirow{{{}}}{{*}}{{
\\
makecell{{{}}}}}
"
.
format
(
method_count
,
approach
))
for
method
in
self
.
methods_per_approach
[
approach
]:
tex_file
.
write
(
"
\n
& \makecell{{{}}}
"
.
format
(
method
))
for
model
in
models
:
# self.log_container_per_model[model].get_best_log()
logs
=
self
.
log_container_per_model
[
model
].
get_logs_by_method
(
method
)
if
len
(
logs
)
==
0
:
tex_file
.
write
(
"
& - & - & - & -
"
)
continue
VPC_count
=
logs
[
0
].
VPC
[
"
count
"
]
+
logs
[
0
].
VPC
[
"
discarded_count
"
]
VPC_used
=
logs
[
0
].
VPC
[
"
count
"
]
OVP
=
len
(
logs
[
0
].
optimization
[
"
OVP
"
])
coverage
=
util
.
set_precision
(
logs
[
0
].
coverage
[
"
percent_fraction
"
]
*
100
,
2
)
tex_file
.
write
(
"
& {} & {} & {} & {}
"
.
format
(
VPC_count
,
VPC_used
,
OVP
,
coverage
))
tex_file
.
write
(
"
\\\\
"
)
tex_file
.
write
(
"
\n\\
end{tabular}
"
)
tex_file
.
write
(
"
\n\\
end{table*}
\n
"
)
tex_file
.
close
()
This diff is collapsed.
Click to expand it.
LogContainer.py
+
12
−
0
View file @
4f76cd4b
...
@@ -39,3 +39,15 @@ class LogContainer:
...
@@ -39,3 +39,15 @@ class LogContainer:
pp
=
pprint
.
PrettyPrinter
(
indent
=
4
)
pp
=
pprint
.
PrettyPrinter
(
indent
=
4
)
print
(
"
Methods per approach:
"
)
print
(
"
Methods per approach:
"
)
pp
.
pprint
(
self
.
methods_per_approach
)
pp
.
pprint
(
self
.
methods_per_approach
)
def
get_logs_by_method
(
self
,
method
):
approach
=
self
.
approaches_per_method
[
method
]
if
approach
not
in
self
.
logs_per_approach
:
return
[]
method_logs
=
[]
for
log
in
self
.
logs_per_approach
[
approach
]:
if
log
.
VPC
[
"
method
"
]
==
method
:
method_logs
.
append
(
log
)
return
method_logs
This diff is collapsed.
Click to expand it.
utilities.py
+
4
−
0
View file @
4f76cd4b
def
convert_to_percentage
(
fraction_array
):
def
convert_to_percentage
(
fraction_array
):
return
[
element
*
100
for
element
in
fraction_array
]
return
[
element
*
100
for
element
in
fraction_array
]
def
set_precision
(
value
,
decimal_count
):
precision_value
=
10
**
decimal_count
return
int
(
value
*
precision_value
)
/
precision_value
This diff is collapsed.
Click to expand it.
vob.py
+
14
−
8
View file @
4f76cd4b
from
Benchmark
import
Benchmark
from
Log
import
Log
from
Log
import
Log
from
Vis
import
Vis
from
LogContainer
import
LogContainer
from
LogContainer
import
LogContainer
from
Vis
import
Vis
import
sys
import
sys
import
json
import
json
...
@@ -22,7 +24,7 @@ def main():
...
@@ -22,7 +24,7 @@ def main():
methods_per_approach
=
json
.
load
(
methods_per_approach_file
)
methods_per_approach
=
json
.
load
(
methods_per_approach_file
)
# Load log files and sort them per model.
# Load log files and sort them per model.
log_container
s
_per_model
=
{}
log_container_per_model
=
{}
logs
=
[]
logs
=
[]
for
filename
in
ovp_paths
:
for
filename
in
ovp_paths
:
log
=
Log
(
filename
)
log
=
Log
(
filename
)
...
@@ -33,12 +35,12 @@ def main():
...
@@ -33,12 +35,12 @@ def main():
continue
continue
model_name
=
log
.
model
[
"
name
"
]
model_name
=
log
.
model
[
"
name
"
]
if
model_name
not
in
log_container
s
_per_model
:
if
model_name
not
in
log_container_per_model
:
print
(
model_name
)
print
(
model_name
)
log_container
s
_per_model
[
model_name
]
=
LogContainer
(
methods_per_approach
)
log_container_per_model
[
model_name
]
=
LogContainer
(
methods_per_approach
)
try
:
try
:
log_container
s
_per_model
[
model_name
].
add_log
(
log
)
log_container_per_model
[
model_name
].
add_log
(
log
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
"
Error: {}
\n
Skipping file
"
.
format
(
e
))
print
(
"
Error: {}
\n
Skipping file
"
.
format
(
e
))
continue
continue
...
@@ -46,14 +48,18 @@ def main():
...
@@ -46,14 +48,18 @@ def main():
# Generate per-approach coverage graphs for each model
# Generate per-approach coverage graphs for each model
vis
=
Vis
()
vis
=
Vis
()
for
model
in
log_container
s
_per_model
:
for
model
in
log_container_per_model
:
print
(
"
Model name: {}
"
.
format
(
model
))
print
(
"
Model name: {}
"
.
format
(
model
))
log_container
s
_per_model
[
model
].
print_status
()
log_container_per_model
[
model
].
print_status
()
vis
.
set_logs
(
log_container
s
_per_model
[
model
])
vis
.
set_logs
(
log_container_per_model
[
model
])
vis
.
generate_graphs
()
vis
.
generate_graphs
()
vis
.
save_graphs
(
prefix
=
model
,
output_path
=
"
./data/
"
)
vis
.
save_graphs
(
prefix
=
model
,
output_path
=
"
./data/
"
)
# vis.show_graphs()
# vis.show_graphs()
benchmark
=
Benchmark
()
benchmark
.
set_log_containers
(
log_container_per_model
)
benchmark
.
generate_tex_table
()
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
()
main
()
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