Predicted values based on a generalized boosted model object - from gbmt
# S3 method for GBMFit
predict(object, newdata, n.trees, type = "link", single.tree = FALSE, ...)
Returns a vector of predictions. By default the predictions are on the scale of f(x). For example, for the Bernoulli loss the returned value is on the log odds scale, poisson loss on the log scale, and coxph is on the log hazard scale.
If type="response"
then gbmt
converts back to the same scale as
the outcome. Currently the only effect this will have is returning
probabilities for bernoulli and expected counts for poisson. For the other
distributions "response" and "link" return the same.
Object of class inheriting from GBMFit
.
Data frame of observations for which to make predictions
Number of trees used in the prediction. If
n.trees
is a vector, predictions are returned for each
iteration specified.
The scale on which gbm makes the predictions
If single.tree=TRUE
then gbm_predict
returns only the predictions from tree(s) n.trees
further arguments passed to or from other methods
predict.GBMFit
produces predicted values for each
observation in a new dataset newdata
using the first
n.trees
iterations of the boosting sequence. If
n.trees
is a vector than the result is a matrix with each
column representing the predictions from gbm models with
n.trees[1]
iterations, n.trees[2]
iterations, and
so on.
The predictions from gbmt
do not include the offset
term. The user may add the value of the offset to the predicted
value if desired.
If gbm_fit_obj
was fit using gbmt
, there will
be no Terms
component. Therefore, the user has greater
responsibility to make sure that newdata
is of the same
format (order and number of variables) as the one originally used
to fit the model.
gbmt