# rJava and RWeka need to be installed
if (FALSE) {
data("iris")
# learn a classifier using automatic default discretization
classifier <- RIPPER_CBA(Species ~ ., data = iris)
classifier
# inspect the rule base
inspect(classifier$rules)
# make predictions for the first few instances of iris
predict(classifier, head(iris))
table(predict(classifier, iris), iris$Species)
# C4.5
classifier <- C4.5_CBA(Species ~ ., iris)
inspect(classifier$rules)
# To use algorithmic options (here for PART), you need to load RWeka
library(RWeka)
# control options can be found using the Weka Option Wizard (WOW)
WOW(PART)
# build PART with control option U (Generate unpruned decision list) set to TRUE
classifier <- PART_CBA(Species ~ ., data = iris, control = RWeka::Weka_control(U = TRUE))
classifier
inspect(classifier$rules)
predict(classifier, head(iris))
}
Run the code above in your browser using DataLab