fix bug in format of input
This commit is contained in:
parent
f295177b1d
commit
c0c6951b73
@ -56,7 +56,7 @@ setMethod("predict", signature = "xgb.Booster",
|
|||||||
if (length(ret) == len){
|
if (length(ret) == len){
|
||||||
ret <- matrix(ret,ncol = 1)
|
ret <- matrix(ret,ncol = 1)
|
||||||
} else {
|
} else {
|
||||||
ret <- matrix(ret, ncol = nrow(newdata))
|
ret <- matrix(ret, ncol = len)
|
||||||
ret <- t(ret)
|
ret <- t(ret)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,6 @@ nround = 5
|
|||||||
# training the model for two rounds
|
# training the model for two rounds
|
||||||
bst = xgb.train(param, dtrain, nround, watchlist)
|
bst = xgb.train(param, dtrain, nround, watchlist)
|
||||||
cat('start testing prediction from first n trees\n')
|
cat('start testing prediction from first n trees\n')
|
||||||
labels <- getinfo(dtest,'label')
|
|
||||||
|
|
||||||
### predict using first 2 tree
|
### predict using first 2 tree
|
||||||
pred_with_leaf = predict(bst, dtest, ntreelimit = 2, predleaf = TRUE)
|
pred_with_leaf = predict(bst, dtest, ntreelimit = 2, predleaf = TRUE)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user