plot the cutoffs for a given scorename
# this function is not perfect (I have labels in mind)
plot.cutoffs <- function(cv.model
,scorenames=c("trainResponse", "trainResponseScaled")
,learned.cv.cutoffs
,functiondir=A_FUNCD){
if(length(scorenames) > 2)
stop("length(scorenames) > 2, this is not implemented yet")
source.function("unlist.getElement", functiondir, silent=TRUE)
unlisted <- unlist.getElement(learned.cv.cutoffs, 2, "cutoff")
unlisted$cutoff <- as.numeric(unlisted$cutoff)
responses <- NULL
for(scoreNameX in scorenames){
if(is.null(responses)){
responses <- unlist.getElement(cv.model, 1, scoreNameX)
}else{
responses <- cbind(responses, unlist.getElement(cv.model, 1, scoreNameX))
}
}
responses <- responses[-c(4,6)]
melted.responses <- melt(responses, id.vars=c("L0", "names"))
colnames(melted.responses)[3] <- "L1"
colnames(melted.responses)[4] <- "cutoff"
plot00 <- ggplot(melted.responses, aes(x=L0, y=cutoff)) +
geom_boxplot(alpha=.4, na.rm = TRUE)+
geom_point(data=unlisted, aes(col=names), position = position_dodge(width=0.15), na.rm = TRUE)+
geom_ribbon(data=unlisted, aes(ymin=0, ymax=..y.., group=names, fill=names), alpha=0.5)+
facet_grid(L1~.)+
scale_fill_brewer(palette="Set1") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=.4))
return(plot00)
}