0

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)
Sotos
  • 51,121
  • 6
  • 32
  • 66
  • It would be easier to help if you provided a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that way possible solutions can be tested and verified. – MrFlick Jun 13 '17 at 15:41
  • Added for you MrFlick – Robert Richardson Jun 13 '17 at 16:46

1 Answers1

0

This question may help to get shorter rules. It will not reduce it to the point which you mentioned, because i think the tree will produce intervalls for each splitting variable, which you should not reduce to only one number. Also if you would have more splitting variables you would need to distingues between them.

Jakob Gepp
  • 463
  • 3
  • 10