-
Notifications
You must be signed in to change notification settings - Fork 0
/
viz-probo-all-comparisons-new.R
148 lines (115 loc) · 6.09 KB
/
viz-probo-all-comparisons-new.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
# this file computes CIs and creates the figures for
# existing PROBO benchmarking results
library(dplyr)
# source functions
source("benchmarking/draw_plot.R")
source("benchmarking/draw_plot_boot.R")
source("benchmarking/draw_plot_boot_facet.R")
source("benchmarking/draw_legend_kapton.R")
# ggplot2 is loaded within these dependencies
# select results
load("benchmarking/results/PROBO-results-graphene-new")
# selection of color palettes
pal_ucs <- 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")
optimum_col = "#ff00f7"
pal <- cbbPalette
# optional: choose colorblind-friendly palette if required
# pal <- safe_colorblind_palette
# set pal globally for comparison
pal = pal[1:4]
# define configurations from the experiments
configs = c("LCB", "ALCB", "EI", "AEI", "EQI", "SE", "GLCB-1-50", "GLCB-1-100", "GLCB-10-100")
# draw plot and compute CIs for GLCB vs EI
configs_indices = c(3,7,8,9)
fun = 1
plots_ei = 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")
# draw plot and compute CIs for GLCB vs LCB
configs_indices = c(1,7,8,9)
plots_lcb = 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")
# draw plot and compute CIs for GLCB vs AEI
configs_indices = c(4,7,8,9)
bench = "AEI"
plots_aei = draw_plot_boot_facet(fun = fun, results_list = results_list, bench = bench,
initial_design_size = 10, pal = pal, configs = configs, configs_indices = configs_indices) +
labs(x = "Evaluations", y = "Mean Best Target Value", col = "Acquisition Function")
# draw plot and compute CIs for GLCB vs ALCB
configs_indices = c(2,7,8,9)
bench = "ALCB"
plots_alcb = draw_plot_boot_facet(fun = fun, results_list = results_list, bench = bench,
initial_design_size = 10, pal = pal, configs = configs, configs_indices = configs_indices) +
labs(x = "Evaluations", y = "Mean Best Target Value", col = "Acquisition Function")
# draw plot and compute CIs for GLCB vs EQI
configs_indices = c(5,7,8,9)
bench = "EQI"
plots_eqi = draw_plot_boot_facet(fun = fun, results_list = results_list, bench = bench,
initial_design_size = 10, pal = pal, configs = configs, configs_indices = configs_indices) +
labs(x = "Evaluations", y = "Mean Best Target Value", col = "Acquisition Function")
# draw plot and compute CIs for GLCB vs SE
configs_indices = c(6,7,8,9)
plots_se = draw_plot_boot_facet(fun = fun, results_list = results_list, bench = "SE",
initial_design_size = 10, pal = pal, configs = configs, configs_indices = configs_indices) +
labs(x = "Evaluations", y = "Mean Best Target Value", col = "Acquisition Function")
# change order of configs to get correct order of legend in ggplot
configs_lcb = configs[c(1,7,8,9)]
configs_ei = configs[c(3,7,8,9)]
configs_alcb = configs[c(2,7,8,9)]
configs_aei = configs[c(4,7,8,9)]
configs_eqi = configs[c(5,7,8,9)]
configs_se = configs[c(6,7,8,9)]
pal[c(1,4)] <- pal[c(4,1)]
pal[4] <- "grey85"
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)]
plots_lcb_pub = plots_lcb + scale_color_manual(values=pal, breaks = configs_lcb)
plots_ei_pub = plots_ei + scale_color_manual(values=pal, breaks = configs_ei)
plots_aei_pub = plots_aei + scale_color_manual(values=pal, breaks = configs_aei)
plots_alcb_pub = plots_alcb + scale_color_manual(values=pal, breaks = configs_alcb)
plots_eqi_pub = plots_eqi + scale_color_manual(values=pal, breaks = configs_eqi)
plots_se_pub = plots_se + scale_color_manual(values=pal, breaks = configs_se)
# Optional: show all single plots
plots_lcb_pub
plots_ei_pub
plots_aei_pub
plots_alcb_pub
plots_se_pub
plots_eqi_pub
#Optional: get publication ready pages with multiple ggplot objects
library(ggpubr)
pub_page = ggarrange(plots_ei_pub, plots_lcb_pub,
ncol = 1, nrow = 2)
pub_page_2 = ggarrange(plots_aei_pub,
plots_alcb_pub, plots_eqi_pub, plots_se_pub,
ncol = 1, nrow = 4)
pub_page_2
pub_page # note that this is figure 2 in the paper
# optional: annotate figures
# annotate_figure(pub_page,
# top = text_grob("GLCB vs. Classic Acquisition Functions (Graphene-Time)", color = "black", face = "bold", size = 14),
# bottom = text_grob("Bayesian optimization of graphene quality depending on laser irradiation time
# 60 runs per Acquisition Function with 90 evaluations 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))
#
#
#
# annotate_figure(pub_page_2,
# top = text_grob("GLCB vs. Classic Acquisition Functions (Graphene-Time)", color = "black", face = "bold", size = 14),
# bottom = text_grob("Bayesian optimization of graphene quality depending on laser irradiation time
# 60 runs per Acquisition Function with 90 evaluations and initial sample size 10 each
# Error bars represent bootstrapped 0.95-CI of incumbent mean best target value
# ALCB = Adaptive Lower Confidence Bound, EQI = Expected Quantile Improvement, SE = Standard Error, AEI = Augmented Expected Improvement.
# GLCB-1-100 means rho = 1 and c = 100. tau = 1 for all GLCBs. Adaptive LCB uses different values for tau
# ", color = "black", face = "bold", size = 10))
#