fix bug in format of input

This commit is contained in:
hetong 2015-01-19 19:26:25 -08:00
parent f295177b1d
commit c0c6951b73
2 changed files with 1 additions and 2 deletions

View File

@ -56,7 +56,7 @@ setMethod("predict", signature = "xgb.Booster",
if (length(ret) == len){
ret <- matrix(ret,ncol = 1)
} else {
ret <- matrix(ret, ncol = nrow(newdata))
ret <- matrix(ret, ncol = len)
ret <- t(ret)
}
}

View File

@ -12,7 +12,6 @@ nround = 5
# training the model for two rounds
bst = xgb.train(param, dtrain, nround, watchlist)
cat('start testing prediction from first n trees\n')
labels <- getinfo(dtest,'label')
### predict using first 2 tree
pred_with_leaf = predict(bst, dtest, ntreelimit = 2, predleaf = TRUE)