-
Notifications
You must be signed in to change notification settings - Fork 17
/
plots.R
64 lines (49 loc) · 2 KB
/
plots.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
library(ggplot2)
library(dplyr)
library(hrbrthemes)
library(extrafont)
loadfonts()
options(stringsAsFactors = F)
x1 = read.delim("~/Downloads/cnn.csv",sep=' ',header=F)
colnames(x1) <- c("n","fold","acc")
x1$Model = 'CNN'
x1 <- x1 %>% group_by(n,Model) %>% summarize(accuracy=mean(acc),std=sd(acc))
x2 = read.delim("~/Downloads/mlp.csv",sep=' ',header=F)
colnames(x2) <- c("n","fold","acc")
x2$Model = 'MLP'
x2 <- x2 %>% group_by(n,Model) %>% summarize(accuracy=mean(acc),std=sd(acc))
x3 = read.delim("~/Downloads/leekasso.csv",sep=' ',header=F)
colnames(x3) <- c("n","fold","acc")
x3$Model = 'Leekasso'
x3 <- x3 %>% group_by(n,Model) %>% summarize(accuracy=mean(acc),std=sd(acc))
x4 = read.delim("~/Downloads/mlp_leek.csv",sep=' ',header=F)
colnames(x4) <- c("n","fold","acc")
x4$Model = 'MLP (Leek)'
x4 <- x4 %>% group_by(n,Model) %>% summarize(accuracy=mean(acc),std=sd(acc))
x <- rbind(x1,x2,x3,x4)
x <- x %>% mutate(low=accuracy-std,high=min(accuracy+std,0.99999))
p1 <- ggplot(x,aes(x=n,y=accuracy,color=Model)) +
geom_point() +
geom_line() +
geom_errorbar(aes(ymin=low,ymax=high),size=0.75,width=1) +
ylim(c(0.5,1)) +
labs(title="Performance on 0 vs. 1 MNIST",
x="Training Sample Size",
y = "Accuracy on Heldout Sample") +
scale_color_ipsum() +
theme_ipsum(plot_title_size=20,axis_text_size=12,axis_title_size=12)
p2 <- x %>% filter(Model != "MLP (Leek)") %>%
ggplot(aes(x=n,y=accuracy,color=Model)) +
geom_point() +
geom_line() +
geom_errorbar(aes(ymin=low,ymax=high),size=0.75,width=1) +
ylim(c(0.9,1)) +
labs(title="Performance on 0 vs. 1 MNIST",
x="Training Sample Size",
y = "Accuracy on Heldout Sample") +
scale_color_ipsum() +
theme_ipsum(plot_title_size=20,axis_text_size=12,axis_title_size=12)
p <- plot_grid(p1, p2,ncol=1)
ggsave(filename = "~/Dropbox (HMS)/beamandrew.github.io/images/deep_learning_works_post/cnn.png",
p,
width = 10, height = 7.5)