-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmakeImages.Rmd
78 lines (63 loc) · 2.34 KB
/
makeImages.Rmd
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
---
title: "makeImages.Rmd"
author: "Rex Sumsion"
date: "3/28/2018"
output: html_document
---
```{r}
setwd("~/Desktop/CAMDA_CMAP_Challenge")
#setwd("~/Desktop")
data <- read.table("numTrees.txt", sep="\t", header=TRUE)
data
```
```{r}
accuracyMean <- tapply(data$accuracy,data$parameterTested,mean)
sensitivityMean <- tapply(data$sensitivity,data$parameterTested,mean)
specificityMean <- tapply(data$specificity,data$parameterTested,mean)
mccMean <- tapply(data$mcc,data$parameterTested,mean)
accuracyMean <- data.frame(accuracyMean)
parameterTested <- row.names(accuracyMean)
prepared.data <- data.frame(parameterTested,accuracyMean,sensitivityMean,specificityMean,mccMean)
prepared.data$parameterTested <- as.numeric(as.character(prepared.data$parameterTested))
prepared.data
```
```{r}
library(ggplot2)
library(gridExtra)
accuracyPlot <- ggplot(prepared.data,aes(parameterTested,accuracyMean))+
geom_line() +
theme_classic() +
geom_vline(xintercept=25, linetype="dashed", color = "red") +
labs(x = "Number of Trees", y = "Mean Accuracy", title="Accuracy")
specificityPlot <- ggplot(prepared.data,aes(parameterTested,specificityMean))+
geom_line() +
theme_classic() +
geom_vline(xintercept=25, linetype="dashed", color = "red") +
labs(x = "Number of Trees", y = "Mean Specificity", title="Specificity")
sensitivityPlot <- ggplot(prepared.data,aes(parameterTested,sensitivityMean))+
geom_line() +
theme_classic() +
geom_vline(xintercept=25, linetype="dashed", color = "red") +
labs(x = "Number of Trees", y = "Mean Sensitivity", title="Sensitivity")
mccPlot <- ggplot(prepared.data,aes(parameterTested,mccMean))+
geom_line() +
theme_classic() +
geom_vline(xintercept=25, linetype="dashed", color = "red") +
labs(x = "Number of Trees", y = "Mean MCC", title="MCC")
#accuracyPlot
#specificityPlot
#sensitivityPlot
#mccPlot
grid.arrange(accuracyPlot,specificityPlot,sensitivityPlot,mccPlot, nrow = 2)
getwd()
ggsave("optomization.png",grid.arrange(accuracyPlot,specificityPlot,sensitivityPlot,mccPlot, nrow = 2))
```
```{r}
## change location for your algorithm and parameter
setwd("ParameterOptomizationGraphs/randomForest/max_leaf_nodes")
##
ggsave("accuracymax_leaf_nodes.png",accuracyPlot)
ggsave("specificitymax_leaf_nodes.png",accuracyPlot)
ggsave("sensitivitymax_leaf_nodes.png",accuracyPlot)
ggsave("mccmax_leaf_nodes.png",accuracyPlot)
```