query.rf.pred.val {RfEmpImp} | R Documentation |
Identify corresponding observed values for the response variable under the
terminal nodes for a random forest model by ranger
Description
The observed values (for the response variable) constituting the terminal
node associated with each observation are queried using the ranger
object and the training data.
The parameter keep.inbag = TRUE
should be applied to call to
ranger
.
Usage
query.rf.pred.val(obj, data, id.name = FALSE, unique.by.id = FALSE, ...)
Arguments
obj |
An R object of class |
data |
Input for training data. |
id.name |
Use the IDs of the terminal nodes as names for the lists. |
unique.by.id |
Only return results of unique terminal node IDs. |
... |
Other parameters (will be ignored). |
Details
The observations are found based on terminal node IDs. It should be noted that the out-of-bag observations are not present in the indexes.
Value
A nested list of length num.trees
.
Author(s)
Shangzhi Hong
Examples
data(iris)
rfObj <- ranger(
Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species,
data = iris, num.trees = 5, keep.inbag = TRUE)
outList <- query.rf.pred.val(rfObj, iris)
[Package RfEmpImp version 2.1.8 Index]