用于重现错误以及我打算获得的内容。我有以下示例。 假设我有一个数据集:Iris。我正在使用
建模分类树library(party)
ct <- ctree(Species ~ ., data = iris) #here Species is the categorical response variable
print(ct)
plot(ct)
但我的问题是如何在每个节点上获得分裂条件,以及终端节点值?
我发现了
library(partykit)
partykit:::.ctree_fit(ct)
很容易找到分裂条件。但是我的数据集需要8个多小时才能将树的maxdepth定义为3。
总结:
library(party)
*注意:我的数据集比Iris数据集复杂一点。我有以下结构
ct <- ctree(Y ~ V1 + V2 + V3 , data= MyData,controls = ctree_control(maxdepth = 3))# here Y is factor variable , V1 & V3 is continous , V2 is categorical variable
当我这样做时:where(ct)
我得到以下错误
*错误:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘where’ for signature ‘"constparty"’
请帮助我进一步解决这个问题