This question is about ctree
in the partykit
package of R. Building regression tree on a continuous response y
with 28 continuous predictors x_1, x_2,...., x_28
, I ran into an error which probably came from the splitting algorithm in 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
My predictors have relatively well behaved distribution (histograms attached).
Question is, what can I do about it?
EDIT : Comparing decision tree algorithms, I tested this data on the ctree
from party
package, no issue at all. I also put it through rpart
, again no problem.
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