Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
paper-2023-data-driven-kernel-designs
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
Service Desk
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
pub
ians-anm
paper-2023-data-driven-kernel-designs
Commits
279e7397
Commit
279e7397
authored
1 year ago
by
Tizian Wenzel
Browse files
Options
Downloads
Patches
Plain Diff
Analysis of timings added.
parent
1f81118b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
section_4.2_visualize.py
+24
-1
24 additions, 1 deletion
section_4.2_visualize.py
with
24 additions
and
1 deletion
section_4.2_visualize.py
+
24
−
1
View file @
279e7397
...
...
@@ -30,10 +30,12 @@ path_for_results = os.path.abspath(os.path.join(os.path.dirname(__file__), 'resu
dic_singular_vals
=
{}
dic_accuracy_deep
=
{}
dic_accuracy_beststd
=
{}
dic_timings
=
{}
for
name_dataset
in
list_datasets
:
dic_singular_vals
[
name_dataset
]
=
{}
dic_accuracy_deep
[
name_dataset
]
=
{}
dic_accuracy_beststd
[
name_dataset
]
=
{}
dic_timings
[
name_dataset
]
=
{
'
list_timings_1L
'
:
[],
'
list_timings_2L
'
:
[]}
## Read all file, perform computations, save results
...
...
@@ -57,10 +59,13 @@ for idx_file, file in enumerate(os.listdir(path_for_results)):
dic_singular_vals
[
name_dataset
][
idx_rerun
]
=
ratio
# Compute and store accuracies
# Compute and store accuracies
as well as timings
dic_accuracy_deep
[
name_dataset
][
idx_rerun
]
=
results
[
'
array_test_rmse_deep
'
]
dic_accuracy_beststd
[
name_dataset
][
idx_rerun
]
=
np
.
min
(
results
[
'
array_test_rmse_cv
'
],
axis
=
0
)
dic_timings
[
name_dataset
][
'
list_timings_1L
'
].
append
(
np
.
array
(
results
[
'
list_timings_1L
'
]))
dic_timings
[
name_dataset
][
'
list_timings_2L
'
].
append
(
np
.
array
(
results
[
'
list_timings_2L
'
]))
## Calculate ranking where 2L performs best to worst: Use the average mean of improvement for this
array_ratio
=
np
.
zeros
(
len
(
list_datasets
))
...
...
@@ -78,10 +83,28 @@ indices_sorted = np.argsort(array_ratio)
## Print the calculated ratio: This shows, when 2L is superior
print
(
'
List indicating when two-layered kernel optimization is beneficial:
'
)
for
idx_sorted
in
indices_sorted
:
print
(
'
{:20}
'
.
format
(
list_datasets
[
idx_sorted
]),
np
.
round
(
array_ratio
[
idx_sorted
],
5
))
## Print timing numbers
for
idx_dataset
,
name_dataset
in
enumerate
(
list_datasets
):
array_timings_1L
=
np
.
stack
(
dic_timings
[
name_dataset
][
'
list_timings_1L
'
])
array_timings_2L
=
np
.
stack
(
dic_timings
[
name_dataset
][
'
list_timings_2L
'
])
t_mean_1L
=
np
.
mean
(
array_timings_1L
)
t_std_1L
=
np
.
std
(
array_timings_1L
)
t_mean_2L
=
np
.
mean
(
array_timings_2L
,
axis
=
0
)
t_std_2L
=
np
.
std
(
array_timings_2L
,
axis
=
0
)
print
(
'
1L runtime: {:6.2f} +- {:5.2f}s.
'
.
format
(
t_mean_1L
,
t_std_1L
)
+
'
2L optim: {:6.2f} +- {:5.2f}.
'
.
format
(
t_mean_2L
[
0
,
0
],
t_std_2L
[
0
,
0
])
+
'
2L greedy: {:6.2f} +- {:5.2f}.
'
.
format
(
t_mean_2L
[
0
,
1
],
t_std_2L
[
0
,
1
])
+
'
(
'
+
name_dataset
+
'
)
'
)
## Visualization of the ratio of singular values compared to sum of all singular values
matplotlib
.
use
(
'
TKAgg
'
)
...
...
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