-
Notifications
You must be signed in to change notification settings - Fork 10
/
plot_hypotheses.r
85 lines (76 loc) · 2.42 KB
/
plot_hypotheses.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
library(ggplot2)
library(scales)
library(ggthemes)
# fig 1
set.seed(42)
demog_data_camcan <- data.frame(
age = c(rgamma(300, 90, 2), rgamma(320, 100, 2)),
gender = c(rep("F", 300), rep("M", 320)),
dataset = "cam-can"
)
demog_data_tuab <- data.frame(
age = c(rgamma(700, 100, 2), rgamma(639, 95, 2)),
gender = c(rep("F", 700), rep("M", 639)),
dataset = "tuab"
)
demog_data_lemon <- data.frame(
age = c(rgamma(90, 105, 2), rgamma(100, 100, 2)),
gender = c(rep("F", 90), rep("M", 100)),
dataset = "lemon"
)
demog_data_chpb <- data.frame(
age = c(rgamma(120, 95, 2), rgamma(130, 105, 2)),
gender = c(rep("F", 120), rep("M", 130)),
dataset = "chbp"
)
demog_data <- rbind(
demog_data_camcan, demog_data_tuab, demog_data_lemon, demog_data_chpb)
ggplot(
aes(x = age, color = gender, fill = gender),
data = demog_data) +
geom_density(alpha=0.4, size=1) +
facet_wrap(.~dataset, ncol=2) +
theme_minimal(base_size = 16) +
scale_color_colorblind() +
scale_fill_colorblind() +
labs(x="Age [years]", y="Density")
ggsave("demographic_hypothesis.png", dpi=150, height = 6, width = 8)
out_grid <- expand.grid(
data = c("tuab", "chbp", "lemon", "cam-can"),
benchmarks = c("dummy", "hand-crafted", "cov-riemann", "cov-mne",
"deep")
)
expected_mae <- expand.grid(
data_delta = c(0.5, -2, -1, 1),
bench_mu = c(16, 10, 8.3, 7.5, 8.7)
)
expected_mae_cv <- cbind(out_grid, expected_mae)
CV <- 10
expected_mae_cv <- do.call(
rbind,
lapply(
seq(nrow(expected_mae_cv)),
function(ii){
this_res <- expected_mae_cv[ii,]
data.frame(data=this_res$data,
benchmark=this_res$benchmarks,
fold=seq(CV),
MAE=rgamma(
CV, (this_res$bench_mu + this_res$data_delta) * 2, 2))
}))
ggplot(
aes(x = MAE, y = interaction(rev(benchmark), data), color = benchmark,
fill = benchmark,
shape = data) ,
data = expected_mae_cv) +
geom_jitter() +
geom_boxplot(alpha=0.1) +
theme_minimal(base_size = 16) +
scale_color_colorblind() +
scale_fill_colorblind() +
scale_y_discrete(
labels = rep(rev(c("dummy", "hand-crafted", "cov-riemann", "cov-mne",
"deep")), times = 5)) +
theme(legend.position = c(.9, .5)) +
labs(y = element_blank(), x = "age prediction MAE [10-fold CV]")
ggsave("benchmark_hypothesis.png", dpi=150, height = 6, width = 8)