predict,xgb.Booster-method

0th

Percentile

Predict method for eXtreme Gradient Boosting model

Predicted values based on xgboost model object.

Usage
## S3 method for class 'xgb.Booster':
predict(object, newdata, outputmargin = FALSE,
  ntreelimit = NULL)
Arguments
object
Object of class "xgb.Boost"
newdata
takes matrix, dgCMatrix, local data file or xgb.DMatrix.
outputmargin
whether the prediction should be shown in the original value of sum of functions, when outputmargin=TRUE, the prediction is untransformed margin value. In logistic regression, outputmargin=T will output value before logistic transformation.
ntreelimit
limit number of trees used in prediction, this parameter is only valid for gbtree, but not for gblinear. set it to be value bigger than 0. It will use all trees by default.
Aliases
  • predict,xgb.Booster-method
Examples
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
bst <- xgboost(data = train$data, label = train$label, max.depth = 2,
               eta = 1, nround = 2,objective = "binary:logistic")
pred <- predict(bst, test$data)
Documentation reproduced from package xgboost, version 0.3-2, License: Apache License (== 2.0) | file LICENSE

Community examples

Looks like there are no examples yet.