improve demo of cv in R

This commit is contained in:
hetong007
2015-01-20 14:35:44 -08:00
parent 947f0a926d
commit eb01acfad8
2 changed files with 5 additions and 1 deletions

View File

@@ -128,7 +128,7 @@ xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL, missing =
for(line in split) dt <- line[2:length(line)] %>% str_extract_all(pattern = "\\d*\\.+\\d*") %>% unlist %>% as.list %>% {vec <- .; rbindlist(list(dt, vec), use.names = F, fill = F)}
if (prediction) {
return(list(dt,predictValues))
return(list(dt = dt,pred = predictValues))
}
return(dt)
}