findTestPreds {forestError} | R Documentation |
Compute and locate test predictions
Description
Predicts each test observation's response using the random forest and, for each test observation and tree, finds the terminal node of the tree in which the test observation falls.
Usage
findTestPreds(forest, X.test, n.cores = 1)
Arguments
forest |
The random forest object being used for prediction. |
X.test |
A |
n.cores |
Number of cores to use (for parallel computation in |
Details
This function accepts regression random forests built using the randomForest
,
ranger
, randomForestSRC
, and quantregForest
packages.
Value
A data.table
with the following four columns:
rowid_test |
The row ID of the test observation as provided by |
pred |
The random forest prediction of the test observation |
tree |
The ID of the tree of the random forest |
terminal_node |
The ID of the terminal node of the tree in which the test observation falls |
Author(s)
Benjamin Lu <b.lu@berkeley.edu>
; Johanna Hardin <jo.hardin@pomona.edu>
See Also
findOOBErrors
, quantForestError