Arguments

Return a matrix with individual predictions for each tree instead of aggregated predictions for all trees (classification and regression only).

num.trees

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

type

Type of prediction. One of 'response' or '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 = '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 matrix of factor levels is returned.
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).