terminalNodeIDs: Get the terminal node id of a RandomForest Object

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Extracts for each observation and for each tree in the forest the terminal node id.

Usage

1
terminalNodeIDs(x, rfObject)

Arguments

x

a data.frame

rfObject

ranger object

Value

Matrix with terminal node IDs for all observations in x (rows) and trees (columns)

Examples

1
2
3
library(ranger)
rf.fit <- ranger(Species ~ ., data = iris, num.trees = 5, write.forest = TRUE)
dfNodes <- terminalNodeIDs(iris[, -5], rf.fit)

CaseBasedReasoning documentation built on June 12, 2018, 5:18 p.m.