I’m using R’s randomForest package. Is there a way for me to figure out the splitting rules used at each node in the computed trees?
Sample code:
library(randomForest)
mydata = data.frame(output = factor(c(0, 0, 0, 1, 1, 1)), x = c(0, 1, 0, 0, 1, 1), y = c(1, 1, 1, 0, 0, 1))
mydata.rf = randomForest(output ~ ., data = mydata, ntree = 3)
I suspect it has something to do with mydata.rf$forest$treemap, but I’m not sure.
Ah, answered it myself: I can use the
getTreefunction, described in the pdf documentation.