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
ea283caa
Commit
ea283caa
authored
4 years ago
by
gospodnetic
Browse files
Options
Downloads
Patches
Plain Diff
Output best results to the table
parent
4f76cd4b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Benchmark.py
+7
-7
7 additions, 7 deletions
Benchmark.py
LogContainer.py
+61
-6
61 additions, 6 deletions
LogContainer.py
with
68 additions
and
13 deletions
Benchmark.py
+
7
−
7
View file @
ea283caa
...
...
@@ -57,16 +57,16 @@ class Benchmark:
tex_file
.
write
(
"
\n
& \makecell{{{}}}
"
.
format
(
method
))
for
model
in
models
:
# self.log_container_per_model[model].get_best_log()
log
s
=
self
.
log_container_per_model
[
model
].
get_
logs_by_method
(
method
)
if
len
(
logs
)
==
0
:
try
:
best_
log
=
self
.
log_container_per_model
[
model
].
get_
best_log
(
method
)
except
:
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
)
VPC_count
=
best_log
.
VPC
[
"
count
"
]
+
best_log
.
VPC
[
"
discarded_count
"
]
VPC_used
=
best_log
.
VPC
[
"
count
"
]
OVP
=
len
(
best_log
.
optimization
[
"
OVP
"
])
coverage
=
util
.
set_precision
(
best_log
.
coverage
[
"
percent_fraction
"
]
*
100
,
2
)
tex_file
.
write
(
"
& {} & {} & {} & {}
"
.
format
(
VPC_count
,
VPC_used
,
OVP
,
coverage
))
tex_file
.
write
(
"
\\\\
"
)
...
...
This diff is collapsed.
Click to expand it.
LogContainer.py
+
61
−
6
View file @
ea283caa
import
Log
import
pprint
from
enum
import
Enum
class
LogContainer
:
def
__init__
(
self
,
methods_per_approach
):
...
...
@@ -13,12 +14,6 @@ class LogContainer:
self
.
__parse_methods_per_approach
()
def
__parse_methods_per_approach
(
self
):
self
.
approaches_per_method
=
{}
for
approach
in
self
.
methods_per_approach
:
for
method
in
self
.
methods_per_approach
[
approach
]:
self
.
approaches_per_method
[
method
]
=
approach
def
add_log
(
self
,
log
):
method
=
log
.
VPC
[
"
method
"
]
if
method
in
self
.
approaches_per_method
:
...
...
@@ -51,3 +46,63 @@ class LogContainer:
method_logs
.
append
(
log
)
return
method_logs
# Log which obtains coverage over 99% with minimal number of viewpoint candidates
# If no log obrains coverage over 99%, the log with the greatest coverage is considered.
def
get_best_log
(
self
,
method
):
method_logs
=
self
.
get_logs_by_method
(
method
)
if
len
(
method_logs
)
==
0
:
raise
Exception
(
"
Error: No logs available for given method ({})
"
.
format
(
method
))
# Find logs with coverage >99%.
high_coverage_logs
=
self
.
__filter_coverage_threshold
(
method_logs
,
0.99
,
ComparisonType
.
GEQ
)
if
len
(
high_coverage_logs
)
>
0
:
return
self
.
max_coverage_log
(
high_coverage_logs
)
else
:
return
self
.
max_coverage_log
(
method_logs
)
def
max_coverage_log
(
self
,
input_logs
=
None
):
if
not
input_logs
:
input_logs
=
self
.
logs
if
len
(
input_logs
)
==
0
:
raise
Exception
(
"
Error: no logs available.
"
)
max_coverage
=
input_logs
[
0
].
coverage
[
"
percent_fraction
"
]
max_log
=
input_logs
[
0
]
for
log
in
input_logs
:
if
log
.
coverage
[
"
percent_fraction
"
]
>
max_coverage
:
max_log
=
log
return
max_log
def
__parse_methods_per_approach
(
self
):
self
.
approaches_per_method
=
{}
for
approach
in
self
.
methods_per_approach
:
for
method
in
self
.
methods_per_approach
[
approach
]:
self
.
approaches_per_method
[
method
]
=
approach
# Find logs which have coverage greater or equal to the given threshold.
# threshold is given as a fraction (e.g. 0.99)
def
__filter_coverage_threshold
(
self
,
input_logs
,
threshold
,
comparison_type
):
filtered_logs
=
[]
for
log
in
input_logs
:
if
comparison_type
==
ComparisonType
.
G
:
if
log
.
coverage
[
"
percent_fraction
"
]
>
threshold
:
filtered_logs
.
append
(
log
)
elif
comparison_type
==
ComparisonType
.
GEQ
:
if
log
.
coverage
[
"
percent_fraction
"
]
>=
threshold
:
filtered_logs
.
append
(
log
)
elif
comparison_type
==
ComparisonType
.
LEQ
:
if
log
.
coverage
[
"
percent_fraction
"
]
<=
threshold
:
filtered_logs
.
append
(
log
)
elif
comparison_type
==
ComparisonType
.
L
:
if
log
.
coverage
[
"
percent_fraction
"
]
<
threshold
:
filtered_logs
.
append
(
log
)
return
filtered_logs
class
ComparisonType
(
Enum
):
G
=
0
# >
GEQ
=
1
# >=
LEQ
=
2
# <=
L
=
3
# <
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