R partykit ctree抱怨“断裂不是唯一的”

时间:2018-12-18 17:11:47

标签: r package decision-tree

此问题与R的ctree包中的partykit有关。在具有28个连续预测变量y的连续响应x_1, x_2,...., x_28上构建回归树时,我遇到了一个错误可能来自ctree中的分割算法。

library(partykit)
ctrl1 = partykit::ctree_control(minsplit=100, minbucket=100, minprob=0.1, maxdepth=Inf)
dc3 = partykit::ctree(y~., data=as.data.frame(X3), control=ctrl1)

Error in interval.numeric(x, breaks = c(xmin - tol, ux, xmax)) : 
'breaks' are not unique

我的预测变量的行为表现相对较好(附有直方图)。

问题是,我该怎么办?

编辑:比较决策树算法,我在ctree包的party上测试了这些数据,一点问题都没有。我也将其放入rpart中,同样没有问题。

library(rpart)
library(party)
ctrl11 = party::ctree_control(minsplit=100,                             minbucket=100, maxdepth=0)
dc31 = party::ctree(y~., data=as.data.frame(X3), control=ctrl11)
X11();plot(dc31)

rpart.cont = list(maxdepth=3, usesurrogate=0, xval=0, cp=0.001, minsplit=10, minbucket=10)
dc3 = rpart(y~., data=as.data.frame(X3),method="anova", model=TRUE, control=rpart.cont)

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

enter image description here

0 个答案:

没有答案