sample_from_ranger: Predict or sample values from fitted ranger object

Description Usage Arguments Details Value See Also

View source: R/sample_from_ranger.R

Description

Determines the predicted value using the 'whole-of-forest' prediction, or evaluates the prediction of a selected tree (tree.imp=T). In the latter case, each row in the data set is predicted using a randomly selected (with replacement) tree in the forest. We call this a 'tree-sampled' prediction and it somewhat corresponds to an sample from the distribution of the predicted value or class given the (new) data.

Usage

1
sample_from_ranger(ranger_fit, data_, response, tree.imp = F, ...)

Arguments

ranger_fit

ranger object; random forest fitted to data of same format as data_ argument.

data_

a data.frame; data.frame with same variables as the data used in the training of ranger_fit.

response

character; name of the dependent variable i.e. the value of dependent.variable.name from the corresponding call to ranger in the fitting step.

tree.imp

logical; set to T to impute using a single (randomly selected with replacement) tree for each row in data_ or F (default) to use the aggregated 'whole-of-forest' prediction.

...

additional arguments passed on to predict.ranger, not including the predict.all or num.trees argument.

Details

Ranger is considered slow at prediction as of 07/2018, particularly for smaller data sets, see issue 133: https://github.com/imbs-hl/ranger/issues/133

Value

predicted or sampled values or classes (with original class and levels)

See Also

ranger


stephematician/miForang documentation built on July 23, 2019, 5:11 p.m.