In [1]:
# This benchmark predicts the maximum of the
# time that's elapsed so far in the trip and
# the mean time in the training set as the
# test trip duration

library(readr)
library(rjson)

test  <- read_csv("/home/tony/ML/taxi/taxi2_time/test.csv")
mean_train_time <- 660

positions <- function(row) as.data.frame(do.call(rbind, fromJSON(row$POLYLINE)))

submission <- test["TRIP_ID"]

for (i in 1:nrow(test)) {
  submission$TRAVEL_TIME[i] <- max(15*nrow(positions(test[i,])), mean_train_time)
}

write_csv(submission, "max_time_elapsed_mean_time_benchmark.csv")


Error in library(readr): there is no package called ‘readr’
Error in eval(expr, envir, enclos): could not find function "read_csv"
Error in eval(expr, envir, enclos): object 'test' not found
Error in nrow(test): object 'test' not found
Error in eval(expr, envir, enclos): could not find function "write_csv"

In [2]:
install.packages('readr')


Installing package into ‘/home/tony/R/x86_64-pc-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
Error in contrib.url(repos, type): trying to use CRAN without setting a mirror

In [ ]: