-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathperformance_viz.R
224 lines (212 loc) · 10.1 KB
/
performance_viz.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
### Visualize the performance of the package tested on the LRZ HPC linux cluster
library(tidyverse)
custom_colors <- c("#92B8DE", "#db4f59", "#477042", "#cc72d6")
theme_set(
theme_minimal() +
theme(plot.title = element_text(size = 11),
plot.subtitle = element_text(size = 9),
legend.position = "bottom")
)
# load the performance results:
load("data/performance_uncond.RData")
results_df
uncond_results_df <- results_df[-1, ] %>%
mutate(family = as.character(family))
uncond_results_df[20:22, "family"] <- c("gaussian/t", "t", "onepar")
load("data/performance_heavy_second.RData")
uncond_results_df <- uncond_results_df %>%
bind_rows(results_df[2:4, 1:6] %>%
mutate(family = as.character(family)))
load("data/performance_max.RData")
uncond_results_df <- uncond_results_df %>%
bind_rows(results_df[2:4, 1:6] %>%
mutate(family = as.character(family)))
uncond_results_df <- uncond_results_df %>%
mutate(parallel_strategy = paste0(first_level_parallel,
"/",
second_level_parallel),
time_minutes = as.numeric(time_minutes))
# compare sample sizes
uncond_results_df %>%
filter(family == "parametric", vars == 10) %>%
mutate(n_samples = if_else(n_samples == "1e+05", "100000", n_samples)) %>%
ggplot(aes(x = factor(parallel_strategy,
levels = c("5/1", "10/1", "4/6", "5/4", "1/25",
"10/2", "10/3", "10/4", "10/25")),
y = time_minutes,
group = n_samples,
col = n_samples, shape = n_samples)) +
geom_point(size = 2) +
geom_line(alpha = 0.4) +
ylim(0, NA) +
scale_color_manual(values = custom_colors[2:4], name = "Simulation sample size") +
labs(x = "Parallel stratgey: first/second level parallelization",
y = "Runtime in minutes",
shape = "Simulation sample size",
title = "Influence of the simulation sample size on runtime",
subtitle = "Variables: 10 with 1000 observations\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nAllowed copula families: all parametric\nEstimation: unconditional")
# compare number of variables
uncond_results_df %>%
mutate(vars = as.numeric(vars)) %>%
filter(family == "parametric", n_samples == "10000",
parallel_strategy == "10/2") %>%
ggplot(aes(x = vars, y = time_minutes)) +
geom_point(size = 2) +
geom_line(alpha = 0.4) +
scale_x_continuous(breaks = unique(as.numeric(uncond_results_df$vars))) +
ylim(0, NA) +
labs(y = "Runtime in minutes",
x = "Number of variables",
title = "Influence of the number of variables on runtime",
subtitle = "Observations per variable: 1000\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nAllowed copula families: all parametric\nEstimation: unconditional\nSimulation sample size: 10000\nParallel strategy: 10/2"
) +
theme(panel.grid.minor.x = element_blank())
# compare the use of different copula families
uncond_results_df %>%
mutate(vars = as.numeric(vars),
family = factor(family,
levels = c("gaussian/t", "t",
"onepar", "parametric")),
family = fct_recode(family, "Student t" = "t", "Gaussian & Student t" = "gaussian/t",
"Single parametric" = "onepar",
"All parametric" = "parametric")) %>%
filter(n_samples == "10000", vars == 10,
parallel_strategy == "10/2") %>%
ggplot(aes(x = family,
y = time_minutes,
group = 1)) +
geom_point(size = 2) +
geom_segment(aes(y = 0, yend = time_minutes,
x = family,
xend = family),
size = 0.5) +
ylim(0, NA) +
labs(y = "Runtime in minutes",
x = "Allowed copula families",
title = "Influence of the allowed copula families on runtime",
subtitle = "Variables: 10 with 1000 observations\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nSimulation sample size: 10000\nParallel strategy: 10/2\nEstimation: unconditional"
)
#-------------------------------------------------------------------------
### now the same for the conditional approach
# load the performance results:
load("data/performance_cond.RData")
cond_results_df <- results_df[-1, ]
load("data/performance_cond2.RData")
cond_results_df <- cond_results_df %>%
bind_rows(results_df[-1, ]) %>%
mutate(family = as.character(family))
cond_results_df[15:17, "family"] <- c("gaussian/t", "t", "onepar")
load("data/performance_cond3.RData")
cond_results_df <- cond_results_df %>%
bind_rows(results_df[-1, ] %>% mutate(family = as.character(family)))
load("data/performance_heavy_second.RData")
cond_results_df <- cond_results_df %>%
bind_rows(results_df[5:7, 1:6] %>%
mutate(family = as.character(family)))
load("data/performance_max.RData")
cond_results_df <- cond_results_df %>%
bind_rows(results_df[5:7, 1:6] %>%
mutate(family = as.character(family)))
cond_results_df <- cond_results_df %>%
mutate(parallel_strategy = paste0(first_level_parallel,
"/",
second_level_parallel),
time_minutes = as.numeric(time_minutes))
# compare sample sizes
cond_results_df %>%
filter(family == "parametric", vars == 10) %>%
mutate(n_samples = if_else(n_samples == "1e+05", "100000", n_samples)) %>%
ggplot(aes(x = factor(parallel_strategy,
levels = c("5/1", "10/1", "4/6", "5/4", "1/25",
"10/2", "10/3", "10/4", "10/25")),
y = time_minutes,
group = n_samples,
col = n_samples, shape = n_samples)) +
geom_point(size = 2) +
geom_line(alpha = 0.4) +
ylim(0, NA) +
scale_color_manual(values = custom_colors[2:4], name = "Simulation sample size") +
geom_segment(aes(x = 7.5, y = 80, xend = 8.9, yend = 35),
arrow = arrow(length = unit(0.3, "cm")),
col = "#6e6e6e") +
annotate("text", x = 6.8, y = 90, size = 3.5, col = "#6e6e6e",
label = "Only 1 fixed\nquantile level\ninstead of 2") +
labs(x = "Parallel stratgey: first/second level parallelization",
y = "Runtime in minutes",
shape = "Simulation sample size",
title = "Influence of the simulation sample size on runtime",
subtitle = "Variables: 10 with 1000 observations\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nAllowed copula families: all parametric\nEstimation: conditional")
# without the 100000
cond_results_df %>%
filter(family == "parametric", vars == 10, n_samples != "1e+05") %>%
mutate(n_samples = if_else(n_samples == "1e+05", "100000", n_samples)) %>%
ggplot(aes(x = factor(parallel_strategy,
levels = c("5/1", "10/1", "4/6", "5/4", "1/25",
"10/2", "10/3", "10/4", "10/25")),
y = time_minutes,
group = n_samples,
col = n_samples, shape = n_samples)) +
geom_point(size = 2) +
geom_line(alpha = 0.4) +
ylim(0, NA) +
scale_color_manual(values = custom_colors[2:4], name = "Sample size") +
labs(x = "Parallel stratgey: first/second level parallelization",
y = "Runtime in minutes",
shape = "Sample size",
title = "Influence of the simulation sample size on runtime",
subtitle = "Variables: 10 with 1000 observations\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nAllowed copula families: all parametric\nEstimation: conditional")
# compare number of variables
cond_results_df %>%
mutate(vars = as.numeric(vars)) %>%
filter(family == "parametric", n_samples == "10000",
parallel_strategy == "10/2") %>%
ggplot(aes(x = vars, y = time_minutes)) +
geom_point(size = 2) +
geom_line(alpha = 0.4) +
scale_x_continuous(breaks = unique(as.numeric(cond_results_df$vars))) +
ylim(0, NA) +
labs(y = "Runtime in minutes",
x = "Number of variables",
title = "Influence of the number of variables on runtime",
subtitle = "Observations per variable: 1000\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nAllowed copula families: all parametric\nEstimation: conditional\nSimulation sample size: 10000\nParallel strategy: 10/2"
) +
theme(panel.grid.minor.x = element_blank())
# compare the use of different copula families
cond_results_df %>%
mutate(vars = as.numeric(vars),
family = factor(family,
levels = c("gaussian/t", "t",
"onepar", "parametric")),
family = fct_recode(family, "Student t" = "t", "Gaussian & Student t" = "gaussian/t",
"Single parametric" = "onepar",
"All parametric" = "parametric")) %>%
filter(n_samples == "10000", vars == 10,
parallel_strategy == "10/2") %>%
ggplot(aes(x = family,
y = time_minutes,
group = 1)) +
geom_point(size = 2) +
geom_segment(aes(y = 0, yend = time_minutes,
x = family,
xend = family),
size = 0.5) +
ylim(0, NA) +
labs(y = "Runtime in minutes",
x = "Allowed copula families",
title = "Influence of the allowed copula families on runtime",
subtitle = "Variables: 10 with 1000 observations\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nSimulation sample size: 10000\nParallel strategy: 10/2\nEstimation: conditional"
)
tibble(x = c(2, 5, 10),
y = c(cond_results_df$time_minutes[19],
cond_u_5_10000, cond_u_10_10000)) %>%
ggplot(aes(x = x, y = y)) +
geom_point(size = 2) +
geom_line(alpha = 0.4) +
scale_x_continuous(breaks = c(2, 5, 10)) +
ylim(0, NA) +
labs(y = "Runtime in minutes",
x = "Number of quantile levels estimated",
title = "Influence of the number of estimated quantile levels on runtime",
subtitle = "Variables: 10 with 1000 observations\nMarginal windows: 5 of size 50\nVine windows: 10 of size 25\nAllowed copula families: all parametric\nSimulation sample size: 10000\nParallel strategy: 10/4\nEstimation: conditional"
) +
theme(panel.grid.minor.x = element_blank())