【发布时间】:2014-05-25 02:07:25
【问题描述】:
我使用cforest创建了随机森林模型
library("party")
crs$rf <- cforest(as.factor(Censor) ~ .,
data=crs$dataset[crs$sample,c(crs$input, crs$target)],
controls=cforest_unbiased(ntree=500, mtry=4))
cf <- crs$rf
tr <- party:::prettytree(cf@ensemble[[1]], names(cf@data@get("input")))
#tr
plot(new("BinaryTree", tree=tr, data=cf@data, responses=cf@responses))
绘制树时出现错误
错误:没有为“strwidth/height”单位提供字符串
任何帮助如何克服这个错误?
【问题讨论】:
-
请发布一个可重现的示例,以便我们了解您要执行的操作 (stackoverflow.com/questions/5963269)
-
在这个问题的最后一个答案中给出了一个技巧:stackoverflow.com/questions/19924402/cforest-prints-empty-tree
标签: r random-forest