predict.rforest {radiant.model} | R Documentation |
Predict method for the rforest function
Description
Predict method for the rforest function
Usage
## S3 method for class 'rforest'
predict(
object,
pred_data = NULL,
pred_cmd = "",
pred_names = "",
OOB = NULL,
dec = 3,
envir = parent.frame(),
...
)
Arguments
object |
Return value from |
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)') |
pred_names |
Names for the predictions to be stored. If one name is provided, only the first column of predictions is stored. If empty, the levels in the response variable of the rforest model will be used |
OOB |
Use Out-Of-Bag predictions (TRUE or FALSE). Relevant when evaluating predictions for the training sample. If set to NULL, datasets will be compared to determine if OOB predictions should be used |
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/rforest.html for an example in Radiant
See Also
rforest
to generate the result
summary.rforest
to summarize results
Examples
result <- rforest(titanic, "survived", c("pclass", "sex"), lev = "Yes")
predict(result, pred_cmd = "pclass = levels(pclass)")
result <- rforest(diamonds, "price", "carat:color", type = "regression")
predict(result, pred_cmd = "carat = 1:3")
predict(result, pred_data = diamonds) %>% head()