简体   繁体   English

如何绘制从使用R中的“插入符”包创建的随机森林中选择的树

[英]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. 我是R的新手,我需要知道如何绘制从使用插入符号包中的train()函数创建的随机森林训练模型中选择的树。

First and foremost, I used a training dataset to create a fitting model of a random forest using the train() function. 首先,我使用训练数据集使用train()函数创建随机森林的拟合模型。 The created random forest contains about 500 trees. 创建的随机森林包含约500棵树。 Is there any methodology to create a plot of a selected tree? 有什么方法可以创建所选树的图?

Thank you. 谢谢。

CRAN package party offers a method called prettyTree . CRAN包party提供了一种称为prettyTree的方法。 Look here 这里

As far as I know, the randomForest package does not have any built-in functionality to plot individual trees. 据我所知, randomForest包没有任何内置功能可以绘制单个树。 You can extract trees using the getTree() function, but nothing is provided to plot / visualize it. 您可以使用getTree()函数提取树,但没有提供任何内容来绘制/可视化它。 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 这个问题可能是重复的,因为在这里这里这里都能找到其他人用来从随机森林中提取树木的快速搜索方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM