Reputation: 1412
I've been using randomForest.getTree to give me a text representation of each tree in my forest but have recently switched to the caret package to train the forests (method='rf'). How can I either get an object that randomForest.getTree understands (since caret is allegedly using the same underlying code) or print out the trees in some other analogous way?
Upvotes: 2
Views: 1354
Reputation: 1412
just figured it out:
library(caret)
.... #load data
model <- train(x,y,method='rf')
getTree(model$finalModel)
Upvotes: 3