I have constructed a J48 decision tree using RWeka. I would like to compare its performance to a decision tree described an existing (externally computed) decision tree. I'm new to RWeka and I'm having trouble manually creating an RWeka decision tree. Ideally, I would like to show the two side-by-side and plot them using the RWeka visualization (It is very informative and clean).
Right now, I'm going to export the RWeka computed decision tree to Graphviz and manipulate it into the structure I want. I want to check before I start and make sure I cant simply specify the rules I want to manually specify a decision tree.
I don't want to compute the decision tree (I've done that), I want to manually construct/specify a decision tree (for uniform comparison in my presentation).
Thank you in advanced.
The
RWeka
package itself cannot do that . However,RWeka
uses thepartykit
package for displaying its trees which can do what you want. Look at thevignette(“partykit“, package = “partykit“)
how you can construct a recursivepartynode
object with pre-specifiedpartysplit
s and then turn them into aconstparty
. The vignette has a hands-on example for this.