Skip to contents

Predict from the results of a xgboost model

Usage

# S3 method for ModelXGBoost
predict(object, newdata, ...)

Arguments

object

A model of class ModelXGBoost

newdata

data of class data.frame or Dataset

...

further arguments

Value

the fitted values. If the input is a data.frame the predicted values will be given back as a vector of class numeric. If the input is dataset like used in model, then the result will be a data.frame

with predictions and true values in dataset

Examples

cars.data <- Dataset(data = cars, target = "dist")
inducer <- InducerXGBoost()
xgbfit <- fit.InducerXGBoost(.inducer = inducer, .data = cars.data)
#> Error in fit.InducerXGBoost(.inducer = inducer, .data = cars.data): could not find function "fit.InducerXGBoost"
predict.ModelXGBoost(object = xgbfit, newdata = data.frame(speed = 10))
#> Error in predict.ModelXGBoost(object = xgbfit, newdata = data.frame(speed = 10)): could not find function "predict.ModelXGBoost"
predict.ModelXGBoost(object = xgbfit, newdata = cars.data[c(1, 2, 3, 4), ])
#> Error in predict.ModelXGBoost(object = xgbfit, newdata = cars.data[c(1,     2, 3, 4), ]): could not find function "predict.ModelXGBoost"