findTestPreds: Compute and locate test predictions

Description Usage Arguments Details Value Author(s) See Also

View source: R/findtestpreds.R

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

1
findTestPreds(forest, X.test, n.cores = 1)

Arguments

forest

The random forest object being used for prediction.

X.test

A matrix or data.frame with the observations to be predicted. Each row should be an observation, and each column should be a predictor variable.

n.cores

Number of cores to use (for parallel computation in ranger).

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 X.test

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


forestError documentation built on Aug. 11, 2021, 1:06 a.m.