-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimp-BO-benchmarking-synthetic-glcb-vs-ei-lcb-viz.R
131 lines (92 loc) · 4.62 KB
/
imp-BO-benchmarking-synthetic-glcb-vs-ei-lcb-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
library(ggpubr)
source("univariate-benchmark-functions/univariate-test-functions-smoof.R")
source("univariate-benchmark-functions/univariate-test-functions-soobench.R")
source("univariate-benchmark-functions/get-synthetic-benchmark-funs-for-minimization.R")
source("imp-BO_benchmarking/draw_plot.R")
source("imp-BO_benchmarking/draw_plot_boot.R")
source("imp-BO_benchmarking/draw_plot_boot_facet.R")
#source("imp-BO_benchmarking/draw_legend_kapton.R")
#source("data/make-kapton-rf.R")
# load results list:
load("imp-BO_benchmarking/results/results-imp-BO-tests-init-10-budget-90-n-40-funs-1-5-glcb-only")
# these functions are used:
synth_test_functions <- all_benchmark_funs[c(1:4,31)]
# some palettes to choose from
pal <- pal_ucscgb("default")(9)
safe_colorblind_palette <- c("#88CCEE", "#CC6677", "#DDCC77", "#117733", "#332288", "#AA4499",
"#44AA99", "#999933", "#882255")
cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
# select palette
pal <- safe_colorblind_palette
# loop over functions
pub_pages = list()
for (fun in 1:5) {
# set pal globally for comparison
pal = pal[1:6]
# list(getOptPathY(cl_bo_res_lcb[["opt.path"]]), getOptPathY(cl_bo_res_ei[["opt.path"]]),
# getOptPathY(glcb_1_100_bo_res[["opt.path"]]),
# getOptPathY(glcb_5_100_bo_res[["opt.path"]]), getOptPathY(glcb_1_50_bo_res[["opt.path"]]),
# getOptPathY(glcb_5_50_bo_res[["opt.path"]]))
configs = c("LCB", "EI", "GLCB-1-100", "GLCB-5-100", "GLCB-1-50", "GLCB-5-50")
configs_indices = c(1,3,4,5,6)
plots = list()
#fun_name <- getName(synth_test_functions[[fun]])
# store all mops (mean opt paths) here
#BO_paths_all_mops <- matrix(nrow = budget, ncol = configs)
plot = draw_plot_boot_facet(fun = fun, results_list = results_list, bench = "LCB",
initial_design_size = 10, pal = pal, configs = configs, configs_indices = configs_indices) +
labs(x = "Evaluations", y = "Mean Best Target Value", col = "Acquisition Function")
plots_lcb <- plot + xlim(0,20) #+ theme_update() + scale_color_manual(values = cbbPalette) #+scale_color_manual()
configs = c("LCB", "EI", "GLCB-1-100", "GLCB-5-100", "GLCB-1-50", "GLCB-5-50")
configs_indices = c(2,3,4,5,6)
plots = list()
#fun_name <- getName(synth_test_functions[[fun]])
# store all mops (mean opt paths) here
#BO_paths_all_mops <- matrix(nrow = budget, ncol = configs)
plot = draw_plot_boot_facet(fun = fun, results_list = results_list, bench = "EI",
initial_design_size = 10, pal = pal, configs = configs, configs_indices = configs_indices) +
labs(x = "Evaluations", y = "Mean Best Target Value", col = "Acquisition Function")
plots[[fun]] = plot
plots_ei <- plot + xlim(0,20) #+ theme_update() + scale_color_manual(values = cbbPalette) #+scale_color_manual()
configs_lcb = configs[c(1,3,4,5,6)]
configs_ei = configs[c(2,3,4,5,6)]
# plots_lcb <- plots_lcb + theme_update() + scale_color_manual(values = cbbPalette, breaks = configs_lcb)
# plots_ei <- plots_ei + theme_update() + scale_color_manual(values = cbbPalette, breaks = configs_ei)
# plots_alcb <- plots_alcb + theme_update() + scale_color_manual(values = cbbPalette)
pal = cbbPalette
pal[c(1,3)] <- pal[c(3,1)]
pal[4] <- "grey85"
#
# pal[c(1,4)] <- pal[c(4,1)]
# show_col(pal)
# pal[1] = "black"
# pal[c(2,3)] <- pal[c(3,2)]
# pal[c(3,4)] <- pal[c(4,3)]
pal[c(1,4)] <- pal[c(4,1)]
pal[c(1,5)] <- pal[c(5,1)]
plots_lcb_pub = plots_lcb + scale_color_manual(values=pal, breaks = configs_lcb)
pal[c(1,4)] <- pal[c(4,1)]
pal[c(2,3)] <- pal[c(3,2)]
pal[c(3,4)] <- pal[c(4,3)]
pal[c(2,3)] <- pal[c(3,2)]
pal[c(3,4)] <- pal[c(4,3)]
pal[c(1,5)] <- pal[c(5,1)]
plots_ei_pub = plots_ei + scale_color_manual(values=pal, breaks = configs_ei)
pub_page = ggarrange(plots_ei_pub, plots_lcb_pub,
ncol = 1, nrow = 2)
pub_pages[[fun]] = pub_page
}
##Optional: annotate figure
pub_pages_notes = list()
for (fun in 1:5) {
name = getName(synth_test_functions[[fun]])
pub_pages_notes[[fun]] = annotate_figure(pub_pages[[fun]],
top = text_grob(paste("GLCB vs. EI and LCB (", name,")", sep=""), color = "black", face = "bold", size = 14),
bottom = text_grob(paste("Bayesian optimization of", name, "
40 runs per Acquisition Function with 90 evaluations (20 shown) and initial sample size 10 each
Error bars represent bootstrapped 0.95-CI of incumbent mean best target value
EI = Expected Improvement, LCB = Lower Confidence Bound
GLCB-1-100 means rho = 1 and c = 100. tau = 1 for all GLCBs and for LCB."),
color = "black", face = "bold", size = 10))
}
pub_pages_notes