I tried using decision tree algorithm in R which is pretty straightforward but while plotting the plot for R48 algorithm all the nodes are labelled as "setosa"
, but on many sites and as per my thinking the nodes must have been different. Can someone please point out the error in the code?
library(RWeka)
m1 <- J48(Species ~ ., data = iris)
m1
summary(m1)
table(iris$Species, predict(m1))
## use partykit package
if(require("partykit", quietly = TRUE)) plot(m1)
## using party
if(require("party", quietly = TRUE)) plot(m1)
There is no error in your code. The problem is that in base R plots, labels on the axes are automatically suppressed if they would otherwise overlap. There are three ticks on each x axis - one for each species, but only Setosa is labelled because otherwise the labels would be plotted over each other.
The simplest solution is to just make your plot larger. For example, if I drag the plot window to fill my screen, the result is: