# This R environment comes with all of CRAN preinstalled, as well as many other helpful packages
# The environment is defined by the kaggle/rstats docker image: https://github.com/kaggle/docker-rstats
# For example, here's several helpful packages to load in 

library(ggplot2) # Data visualization

ToScore <- data.frame(actual = rep(1, 50000), preds = seq(-0.9999, 4.0000, 0.0001))
ToScore <- cbind(ToScore, RMSLE = sqrt((log(ToScore[, "preds"]+1) - log(ToScore[, "actual"]+1)) ^ 2))
ggplot(data = ToScore[, c(2:3)], aes(x = preds, y = RMSLE, color = RMSLE, fill = RMSLE)) + geom_line(aes(size = RMSLE)) + geom_rug() + labs(title = "RMSLE vs Prediction when actual = 1", x = "Predictions", y = "RMSLE")
plot(ToScore[, c(2,3)])