I have built a multi-layer decision tree using rpart
and I am trying to replicate the tree structure using partykit
package, more specifically, the partysplit
-partynode
combo.
I am currently having an issue with the order difference between rpart
and partysplit
.
The decision tree coming from rpart
always take "greater than" sign (>) first then "less than" sign (<) underneath while partykit
is the opposite.
e.g., the rpart
output
[6] value.a >= 33: FALSE. (n = 63, err = 33.3%)
[7] value.a< 33: FALSE. (n = 74, err = 8.1%)
vs. the partykit
output
[6] value.a < 33: FALSE. (n = 74, err = 8.1%)
[7] value.a >= 33: FALSE. (n = 63, err = 33.3%)
As a result, I am having trouble reading the decision tree in correct order and using partykit
to recreate the tree from rpart
.
Is there a way I can create a tree from rpart
such as the tree take "less than" sign first, or is there an option on partysplit
such that you make the split take the "greater than" sign first?