-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_alarm_results_nonmyopic.R
352 lines (284 loc) · 28.1 KB
/
plot_alarm_results_nonmyopic.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
library(ggplot2)
library(plyr)
library(RColorBrewer)
library(reshape2)
setwd("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/NonMyopicOutput/")
files <- list.files()
data <- data.frame()
for (file in files) {
tmp <- read.table(file, sep=";", header=T)
tmp$cls <- "rf"
data <- rbind(data, tmp)
}
data$metric <- gsub("_mean", "", data$metric)
data$ratio <- paste(data$c_miss, data$c_action, sep=":")
base_size <- 36
line_size <- 1
point_size <- 4
data <- subset(data, dataset != "bpic2018")
data <- subset(data, dataset != "uwv")
data$method <- as.character(data$method)
data$dataset <- as.character(data$dataset)
data$method[data$method=="fixed0"] <- "always alarm"
data$method[data$method=="fixed110"] <- "never alarm"
data$method[data$method=="fixed50"] <- "tau=0.5"
data$method[data$method=="single_threshold"] <- "Single Alarm"
data$method[data$method=="opt_threshold"] <- "optimized"
data$dataset[data$dataset=="uwv_all"] <- "uwv"
data$dataset[data$dataset=="traffic_fines_1"] <- "traffic_fines"
data <- subset(data, cls=="rf")
#print(subset(data,method=="perfect_prediction"))
head(data)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="cost_avg" & !grepl("fixed", method) & c_com==2 & c_miss <= 20 & early_type=="const"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("Avg. cost per case") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_ratios_const.pdf",width = 20, height = 20)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="cost_avg" & !grepl("fixed", method) & c_com==2 & c_miss <= 20 & early_type=="linear"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("Avg. cost per case") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_ratios_linear.pdf",width = 20, height = 20)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="cost_avg" & !grepl("fixed", method) & c_com==20 & c_miss <= 20 & early_type=="const"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("Avg. cost per case") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_ratios_linear_com20.pdf",width = 20, height = 20)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="fscore" & !grepl("fixed", method) & c_com==2 & c_miss <= 20 & early_type=="linear"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("F-Score") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/fscore_ratios_linear.pdf",width = 20, height = 20)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="fscore" & !grepl("fixed", method) & c_com==2 & c_miss <= 20 & early_type=="const"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("fscore") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/fscore_ratios_const.pdf",width = 20, height = 20)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="fscore" & !grepl("fixed", method) & c_com==20 & c_miss <= 20 & early_type=="const"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("fscore") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/fscore_ratios_linear_com20.pdf",width = 20, height = 20)
dt_as_bad <- subset(data, metric=="cost_avg" & method=="optimized")
dt_as_good <- subset(data, metric=="cost_avg" & method=="prefix_threshold")
dt_merged <- merge(dt_as_bad, dt_as_good, by=c("dataset", "c_miss", "c_action", "c_postpone", "c_com", "early_type", "cls", "ratio"), suffixes=c("_as_bad", "_as_good"))
dt_merged$ratioBestWort <- (dt_merged$value_as_good/dt_merged$value_as_bad)
dt_merged$ratio <- as.factor(dt_merged$ratio)
#print(dt_merged$ratio)
dt_merged$ratio <- factor(dt_merged$ratio, levels(dt_merged$ratio)[c(1,3,5,6,2,4)])
dt_merged$benefit <- ifelse(dt_merged$value_as_good < dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
dt_merged$disadvantage <- ifelse(dt_merged$value_as_good > dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
#print(dt_merged$ratio)
dt_merged$ratio_com <- as.factor(dt_merged$c_com)
#dt_merged$ratio_com <- factor(dt_merged$ratio_com, levels(dt_merged$ratio_com)[c(1,13,10,2,14,12,11,3,5,7,9,4,6,8)])
#print(dt_merged$ratio_com)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"), aes(factor(ratio_com), factor(ratio))) + geom_tile(aes(fill = ratioBestWort), colour = "black") +
theme_bw(base_size=base_size) + scale_fill_gradientn(colours=c("green","white","red")) +
xlab("c_in : c_com") + ylab("c_out : c_in") + theme(axis.text.x = element_text(size=20)) + facet_wrap( ~ dataset, ncol=4)
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_heatmap_normal_vs_nonmyopic_prefix_const.pdf", width = 40, height = 40)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"), aes(factor(ratio_com), factor(ratio))) + geom_tile(aes(fill = ratioBestWort), colour = "black") +
theme_bw(base_size=base_size) + scale_fill_gradientn(colours=c("green","white","red")) +
xlab("c_in : c_com") + ylab("c_out : c_in") + theme(axis.text.x = element_text(size=20)) + facet_wrap( ~ dataset, ncol=4)
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_heatmap_normal_vs_nonmyopic_prefix_linear.pdf", width = 40, height = 40)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"), aes(factor(ratio_com), factor(ratio))) + geom_tile(aes(fill = ratioBestWort), colour = "black") +
theme_bw(base_size=base_size) + scale_fill_gradientn(colours=c("green","white","red"),breaks=c(0.8,1.0,1.2)) +
xlab("c_in : c_com") + ylab("c_out : c_in") + theme(axis.text.x = element_text(size=20)) + facet_wrap( ~ dataset, ncol=4)
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_heatmap_normal_vs_nonmyopic_prefix_nonmonotonic.pdf", width = 40, height = 40)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="cost_avg" & !grepl("fixed", method) & c_com==2 & c_miss <= 20 & early_type=="nonmonotonic"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("Avg. cost per case") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_ratios_nonmonotonic.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_nonmonotonic.pdf",width = 20, height = 20)
color_palette <- c("#0072B2", "#000000", "#E69F00", "#009E73", "#56B4E9","#D55E00", "#999999", "#F0E442", "#CC79A7")
ggplot(subset(data, c_postpone==0 & metric=="cost_avg" & !grepl("fixed", method) & c_com==20 & c_miss <= 20 & early_type=="nonmonotonic"), aes(x=c_miss, y=value, color=method, shape=method)) +
geom_point(size=point_size) + geom_line(size=line_size)+ scale_shape_manual(values=seq(0,15)) + scale_x_continuous(breaks=c(3,10,20),
labels=c("3:1", "10:1", "20:1"))+
theme_bw(base_size=26) + ylab("Avg. cost per case") + xlab("c_out : c_in") + facet_wrap( ~ dataset, ncol=4) +
scale_color_manual(values=color_palette) + theme(legend.position="top")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_ratios_nonmonotonic_com20.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_nonmonotonic_prefix.pdf",width = 20, height = 20)
dt_as_good <- subset(data, metric=="cost_avg" & method=="min_prefix")
dt_merged <- merge(dt_as_bad, dt_as_good, by=c("dataset", "c_miss", "c_action", "c_postpone", "c_com", "early_type", "cls", "ratio"), suffixes=c("_as_bad", "_as_good"))
dt_merged$ratioBestWort <- (dt_merged$value_as_good/dt_merged$value_as_bad)
dt_merged$ratio <- as.factor(dt_merged$ratio)
#print(dt_merged$ratio)
dt_merged$ratio <- factor(dt_merged$ratio, levels(dt_merged$ratio)[c(1,3,5,6,2,4)])
dt_merged$benefit <- ifelse(dt_merged$value_as_good < dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
dt_merged$disadvantage <- ifelse(dt_merged$value_as_good > dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
#print(dt_merged$ratio)
dt_merged$ratio_com <- as.factor(dt_merged$c_com)
#dt_merged$ratio_com <- factor(dt_merged$ratio_com, levels(dt_merged$ratio_com)[c(1,13,10,2,14,12,11,3,5,7,9,4,6,8)])
#print(dt_merged$ratio_com)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_nonmonotonic_min_prefix.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_const_min_prefix.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_linear_min_prefix.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_nonmonotonic_min_prefix.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_const_min_prefix.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_linear_min_prefix.pdf",width = 20, height = 20)
dt_as_good <- subset(data, metric=="cost_avg" & method=="3_prefixes")
dt_merged <- merge(dt_as_bad, dt_as_good, by=c("dataset", "c_miss", "c_action", "c_postpone", "c_com", "early_type", "cls", "ratio"), suffixes=c("_as_bad", "_as_good"))
dt_merged$ratioBestWort <- (dt_merged$value_as_good/dt_merged$value_as_bad)
dt_merged$ratio <- as.factor(dt_merged$ratio)
#print(dt_merged$ratio)
dt_merged$ratio <- factor(dt_merged$ratio, levels(dt_merged$ratio)[c(1,3,5,6,2,4)])
dt_merged$benefit <- ifelse(dt_merged$value_as_good < dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
dt_merged$disadvantage <- ifelse(dt_merged$value_as_good > dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
#print(dt_merged$ratio)
dt_merged$ratio_com <- as.factor(dt_merged$c_com)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_nonmonotonic_3_prefixes.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_const_3_prefixes.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_linear_3_prefixes.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_nonmonotonic_3_prefixes.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_const_3_prefixes.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_linear_3_prefixes.pdf",width = 20, height = 20)
dt_as_good <- subset(data, metric=="cost_avg" & method=="2_prefix_user")
dt_merged <- merge(dt_as_bad, dt_as_good, by=c("dataset", "c_miss", "c_action", "c_postpone", "c_com", "early_type", "cls", "ratio"), suffixes=c("_as_bad", "_as_good"))
dt_merged$ratioBestWort <- (dt_merged$value_as_good/dt_merged$value_as_bad)
dt_merged$ratio <- as.factor(dt_merged$ratio)
#print(dt_merged$ratio)
dt_merged$ratio <- factor(dt_merged$ratio, levels(dt_merged$ratio)[c(1,3,5,6,2,4)])
dt_merged$benefit <- ifelse(dt_merged$value_as_good < dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
dt_merged$disadvantage <- ifelse(dt_merged$value_as_good > dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
#print(dt_merged$ratio)
dt_merged$ratio_com <- as.factor(dt_merged$c_com)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_nonmonotonic_2_user.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_const_2_user.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_linear_2_user.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_nonmonotonic_2_user.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_const_2_user.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_linear_2_user.pdf",width = 20, height = 20)
dt_as_bad <- subset(data, metric=="cost_avg" & method=="min_prefix")
dt_merged <- merge(dt_as_bad, dt_as_good, by=c("dataset", "c_miss", "c_action", "c_postpone", "c_com", "early_type", "cls", "ratio"), suffixes=c("_as_bad", "_as_good"))
dt_merged$ratioBestWort <- (dt_merged$value_as_good/dt_merged$value_as_bad)
dt_merged$ratio <- as.factor(dt_merged$ratio)
#print(dt_merged$ratio)
dt_merged$ratio <- factor(dt_merged$ratio, levels(dt_merged$ratio)[c(1,3,5,6,2,4)])
dt_merged$benefit <- ifelse(dt_merged$value_as_good < dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
dt_merged$disadvantage <- ifelse(dt_merged$value_as_good > dt_merged$value_as_bad, dt_merged$value_as_bad - dt_merged$value_as_good, 0)
#print(dt_merged$ratio)
dt_merged$ratio_com <- as.factor(dt_merged$c_com)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_nonmonotonic_user_vs._empirical.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_user_vs._empirical.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = disadvantage), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "black", high = "white") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_disadvantage_linear_user_vs._empirical.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("nonmonotonic", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_nonmonotonicuser_vs._empirical.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("const", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_const_user_vs._empirical.pdf",width = 20, height = 20)
ggplot(subset(dt_merged, cls=="rf" & c_miss %in% c(1,2,3,5,10,20) & grepl("linear", early_type) & ratio!="3:1"),aes(factor(ratio_com), factor(ratio))) +
geom_tile(aes(fill = benefit), colour = "white") +
theme_bw(base_size=base_size) + scale_fill_gradient(low = "white", high = "black") + facet_wrap( ~ dataset, ncol=2) +
xlab("c_in : c_com") + ylab("c_out : c_in")
ggsave("/Users/stephanf/Dropbox/Dokumente/Masterstudium/Masterthesis/testresults/NonMyopic/results_benefit_user_vs._empirical.pdf",width = 20, height = 20)