predict.ranger: Ranger prediction

Description Usage Arguments Details Value Author(s) References See Also

View source: R/predict.R

Description

Prediction with new data and a saved forest from Ranger.

Usage

1
2
3
4
## S3 method for class 'ranger'
predict(object, data, predict.all = FALSE,
  num.trees = object$num.trees, type = "response", seed = NULL,
  num.threads = NULL, verbose = TRUE, ...)

Arguments

object

Ranger ranger object.

data

New test data of class data.frame or gwaa.data (GenABEL).

predict.all

Return individual predictions for each tree instead of aggregated predictions for all trees. Return a matrix (sample x tree) for classification and regression, a 3d array for probability estimation (sample x class x tree) and survival (sample x time x tree).

num.trees

Number of trees used for prediction. The first num.trees in the forest are used.

type

Type of prediction. One of 'response', 'se', 'terminalNodes' with default 'response'. See below for details.

seed

Random seed used in Ranger.

num.threads

Number of threads. Default is number of CPUs available.

verbose

Verbose output on or off.

...

further arguments passed to or from other methods.

Details

For type = 'response' (the default), the predicted classes (classification), predicted numeric values (regression), predicted probabilities (probability estimation) or survival probabilities (survival) are returned. For type = 'se', the standard error of the predictions are returned (regression only). The jackknife-after-bootstrap is used to estimate the standard errors based on out-of-bag predictions. See Wager et al. (2014) for details. For type = 'terminalNodes', the IDs of the terminal node in each tree for each observation in the given dataset are returned.

For classification and predict.all = TRUE, a factor levels are returned as numerics. To retrieve the corresponding factor levels, use rf$forest$levels, if rf is the ranger object.

Value

Object of class ranger.prediction with elements

predictions Predicted classes/values (only for classification and regression)
unique.death.times Unique death times (only for survival).
chf Estimated cumulative hazard function for each sample (only for survival).
survival Estimated survival function for each sample (only for survival).
num.trees Number of trees.
num.independent.variables Number of independent variables.
treetype Type of forest/tree. Classification, regression or survival.
num.samples Number of samples.

Author(s)

Marvin N. Wright

References

See Also

ranger


ranger documentation built on June 20, 2017, 5:03 p.m.

Search within the ranger package
Search all R packages, documentation and source code