I'm running ctree on a numerical value. I have a number of terminal nodes and I'm trying to get them to be more human readable.
I can get information on a terminal node (For example, Node 15, 0.529, n=30539, err = 7609) I can get splitting rules using
list.rules.party()
(for example, daysdq <= 27 & daysdq <= 13 & daysdq > 2 & daysdq > 6)
Is there any way to get a simplified version, where I get something along the lines of:
Node 15, 6
Essentially, is there a command that can give me simplified range rules for numerical values, in addition to the normal terminal node data? Party or Partykit is fine
Here is a reproducable example. It should create 5 terminal nodes <150, 150 to 200, 200 to 250, 250 to 300, and >300
library(partykit)
set.seed(27864)
#Read In Data
x<-runif(100000,100,500)
y<-ifelse(runif(100000,0,1) < floor(x/50)/30*5,1,0)
mydata1<-data.frame(y,x)
FMLA = y ~ x
TreeMdl = ctree(FMLA,
data=mydata1,
)
plot(TreeMdl, type = "simple")
print(TreeMdl)
partykit:::.list.rules.party(TreeMdl)