R randomForest - how to predict with a “getTree” tree
问题 Background: I can make a random Forest in R: set.seed(1) library(randomForest) data(iris) model.rf <- randomForest(Species ~ ., data=iris, importance=TRUE, ntree=20, mtry = 2) I can predict values using the randomForest object that I just made: my_pred <- predict(model.rf) plot(iris$Species,my_pred) I can then peel off some random tree from the forest: idx <- sample(x = 1:20,size = 1,replace = F) single_tree <- getTree(model.rf,k=1) Questions: How do I predict from a single tree pulled from