从R的randomForest软件包计算出的树规则打印输出

3
我正在使用R的randomForest包。有没有办法让我找出计算树中每个节点使用的分割规则?
示例代码:
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)

我怀疑这与mydata.rf$forest$treemap有关,但我不确定。

1个回答

3
啊,我自己找到了答案:我可以使用在pdf文档中描述的getTree函数。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接