-
Notifications
You must be signed in to change notification settings - Fork 39
/
3b-time_mem_predictions.R
48 lines (40 loc) · 1.65 KB
/
3b-time_mem_predictions.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
#' Comparison between predicted versus actual running time and memory usage
join <-
data %>%
filter(error_status %in% c("no_error", "time_limit", "memory_limit")) %>%
mutate(
time = ifelse(error_status == "memory_limit", NA, time),
mem = ifelse(error_status == "time_limit" | mem < log10(100e6), NA, mem),
ltime = log10(time),
lmem = log10(mem)
)
range_time <- quantile(abs(join$ltime - join$time_lpred), .9, na.rm = TRUE) %>% {2 * c(-., .)}
range_mem <- quantile(abs(join$lmem - join$mem_lpred), .9, na.rm = TRUE) %>% {2 * c(-., .)}
g1 <-
ggplot(join) +
geom_point(aes(time_lpred, ltime, colour = ltime - time_lpred)) +
theme_bw() +
facet_wrap(~method_id, scales = "free") +
scale_color_distiller(palette = "RdYlBu", limits = range_time)
g2 <-
ggplot(join) +
geom_point(aes(mem_lpred, lmem, colour = lmem - mem_lpred)) +
theme_bw() +
facet_wrap(~method_id, scales = "free") +
scale_color_distiller(palette = "RdYlBu", limits = range_mem)
pdf(result_file("compare_pred_ind.pdf"), width = 20, height = 15)
print(g1 + labs(title = "Timings"))
print(g2 + labs(title = "Memory"))
dev.off()
g1 <- ggplot(join) +
geom_point(aes(time_lpred, ltime, colour = ltime - time_lpred)) +
theme_bw() +
scale_color_distiller(palette = "RdYlBu", limits = range_time) +
theme(legend.position = "bottom")
g2 <- ggplot(join %>% filter(lmem > 8)) +
geom_point(aes(mem_lpred, lmem, colour = lmem - mem_lpred)) +
theme_bw() +
scale_color_distiller(palette = "RdYlBu", limits = range_mem) +
theme(legend.position = "bottom")
ggsave(result_file("compare_pred_all.pdf"), patchwork::wrap_plots(g1, g2, nrow = 1), width = 16, height = 8)
rm(join, g1, g2)