predict.gbt {radiant.model}R Documentation

Predict method for the gbt function

Description

Predict method for the gbt function

Usage

## S3 method for class 'gbt'
predict(
  object,
  pred_data = NULL,
  pred_cmd = "",
  dec = 3,
  envir = parent.frame(),
  ...
)

Arguments

object

Return value from gbt

pred_data

Provide the dataframe to generate predictions (e.g., diamonds). The dataset must contain all columns used in the estimation

pred_cmd

Generate predictions using a command. For example, ‘pclass = levels(pclass)' would produce predictions for the different levels of factor 'pclass'. To add another variable, create a vector of prediction strings, (e.g., c(’pclass = levels(pclass)', 'age = seq(0,100,20)')

dec

Number of decimals to show

envir

Environment to extract data from

...

further arguments passed to or from other methods

Details

See https://radiant-rstats.github.io/docs/model/gbt.html for an example in Radiant

See Also

gbt to generate the result

summary.gbt to summarize results

Examples

result <- gbt(
  titanic, "survived", c("pclass", "sex"),
  early_stopping_rounds = 2, nthread = 1
)
predict(result, pred_cmd = "pclass = levels(pclass)")
result <- gbt(diamonds, "price", "carat:color", type = "regression", nthread = 1)
predict(result, pred_cmd = "carat = 1:3")
predict(result, pred_data = diamonds) %>% head()

[Package radiant.model version 1.6.6 Index]