In this case I\'m using the RWeka package and J48 within the Cost Sensitive Classifier function. I know with the package \"party\" I can plot a normal J48 tree, but not sure
Actually, it turns out to be pretty easy. Try
library(RWeka)
library(party)
library(partykit)
csc <- CostSensitiveClassifier(Species ~ ., data = iris,
control = Weka_control(`cost-matrix` = matrix(c(0,10, 0, 0, 0, 0, 0, 10, 0),
ncol = 3),
W = "weka.classifiers.trees.J48",
M = TRUE))
plot(as.party.Weka_tree(csc))
That gives me
The problem is, this model reports it's class as
> class(csc)
[1] "CostSensitiveClassifier" "Weka_meta" "Weka_classifier"
and there is no method for those classes. However, there is one for "Weka_tree" which just calls as.party.Weka_tree
and plots the result. I must admit I don't know the differences between a CostSensitiveClassifier tree and a J48 tree so I hope this plot is an accurate representation.