Chamara Manoj
Chamara Manoj

Reputation: 59

How can I plot a tree selected from the random forest created using "caret" package in R

I am newbie in R and I need to know how to plot a tree selected from a random forest training model created using the train () function in caret package.

First and foremost, I used a training dataset to create a fitting model of a random forest using the train() function. The created random forest contains about 500 trees. Is there any methodology to create a plot of a selected tree?

Thank you.

Upvotes: 0

Views: 1814

Answers (2)

MHammer
MHammer

Reputation: 1314

As far as I know, the randomForest package does not have any built-in functionality to plot individual trees. You can extract trees using the getTree() function, but nothing is provided to plot / visualize it. This question may be a duplicate as a quick search yielded approaches other people have used to extract trees from a random forest are found here and here and here

Upvotes: 0

Robert Hadow
Robert Hadow

Reputation: 459

CRAN package party offers a method called prettyTree. Look here

Upvotes: 0

Related Questions