diff --git a/ccn2019/ccn2019_diagrams.R b/ccn2019/ccn2019_diagrams.R index 5ae7299..329d274 100644 --- a/ccn2019/ccn2019_diagrams.R +++ b/ccn2019/ccn2019_diagrams.R @@ -64,6 +64,7 @@ chance.df <- data.frame(x=1:100, y=1:100, model=" ", auc=50) +library(tidyverse) library(ggrepel) dats <- rbind(extd.df, base.df, chance.df) @@ -85,9 +86,8 @@ group=model, color = model, linetype = factor(model))) + - geom_line() + - labs(title="AUCs for the base and extended models") + - geom_label_repel(aes(label=label), na.rm = TRUE, box.padding = 2) + + geom_path(size=0.8) + + geom_label_repel(aes(label=label), na.rm = TRUE, box.padding = 1) + xlab("100% - Specificity") + ylab("Sensitivity") + theme_linedraw() + @@ -99,20 +99,62 @@ ggsave("fig1.png", plot = last_plot(), width = 4, height = 4) +library(latex2exp) + +tex_labels <- c( + TeX("Stimulus"), + TeX("Vocabulary Size ($x_v$)"), + TeX("Recent Lures Ratio"), + TeX("Skewness"), + TeX("Targets Ratio"), + TeX("Lures Ratio"), + TeX("$N$"), + TeX("Recent Skewness"), + TeX("Recent Lumpiness"), + TeX("Recent Vocabulary Size"), + TeX("Recent Targets Ratio") +) + +feat_names <- c( + "Stimulus", + "Vocabulary Size", + "Recent Lures Ratio", + "Skewness", + "Targets Ratio", + "Lures Ratio", + "N", + "Recent Skewness", + "Recent Lumpiness", + "Recent Vocabulary Size", + "Recent Targets Ratio" +) + +#attStats(boruta_result) %>% +# arrange(desc(meanImp)) %>% boruta_scores %>% - mutate(feature = row.names(.)) %>% - arrange(meanImp) %>% - ggplot(aes(x=reorder(feature,-meanImp), y=meanImp, fill=decision)) + - geom_bar(stat = "identity") + + mutate(feature = rev(feat_names)) %>% +# ggplot(aes(x=reorder(feature,meanImp,), y=meanImp, fill=decision, label=meanImp)) + + ggplot(aes(x=reorder(feature,meanImp,), y=meanImp, label=meanImp)) + + geom_bar(stat = "identity",width = 0.75) + + #geom_text(size = 3, position = position_stack(vjust = 1.2)) + ylab("Relative Importance Score") + xlab("Feature") + theme_linedraw() + - scale_fill_grey() + - labs(fill = "Selection Decision") + + scale_fill_manual(values=c("#303030","#a0a0a0")) + + labs(fill = "Feature Selection Decision") + theme( - legend.position = c(.95, .95), + text=element_text(size=16), + axis.title.y = element_blank(), + axis.text.x = element_text(size = 14,colour = "#a0a0a0"), + axis.text.y = element_text(size = 22), + axis.title.x = element_text(size = 22), + legend.position = "none", +# legend.position = c(.95, .15), legend.justification = c("right", "top"), legend.box.just = "right", - legend.margin = margin(6, 6, 6, 6) - ) + legend.margin = margin(5, 5, 5, 5) + ) + + coord_flip() + +ggsave("fig2.png", plot = last_plot(), width = 9, height = 4.75)