[R] randomForest2Rules
saskay
sashi1985 at gmail.com
Mon Feb 27 09:38:42 CET 2012
Hi,
The work around this is to use printRandomForests function in Rattle
package. It outputs the forest in the form of rules.
For ex:
#Load libraries
library(rattle)
library(randomForest)
#Load sample data
data(iris)
#Build a forest
iris.rf <- randomForest(Species ~ ., data=iris,
importance=TRUE,keep.forest=T, ntree=5, do.trace=T)
iris.rf
#send rules in above forest to a textfile
sink(file = "rfrules.txt", append = FALSE, type = "output")
printRandomForests(iris.rf)
sink()
After getting the rules in to a text file, and because the text is
structured, you can use the language of your choice to transform the rules
in to a format you need.
--
View this message in context: http://r.789695.n4.nabble.com/randomForest2Rules-tp3822530p4423956.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list