How to extract rules from rxDTree object

There is no direct function for printing the rules in an rxDTree object but rules can be extracted by first converting the rxDTree object to an equivalent rpart object and calling asRules() from the rattle package.

Example:
library(rattle)
set.seed(1234) 
# classification 
iris.sub <- c(sample(1:50, 25), sample(51:100, 25), sample(101:150, 25)) 
iris.dtree <- rxDTree(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width,  data = iris[iris.sub, ]) 
iris.dtree 
asRules(as.rpart(iris.dtree))
Properties

Article ID: 3103829 - Last Review: Nov 1, 2015 - Revision: 1

Revolution Analytics

Feedback