extractRules | R Documentation |
Extract rule conditions from a list of trees. Use functions RF2List/GBM2List to transform RF/GBM objects to list of trees.
extractRules(treeList, X, ntree = 100, maxdepth = 6, random = FALSE, digits = NULL)
treeList |
tree list |
X |
predictor variable matrix |
ntree |
conditions are extracted from the first ntree trees |
maxdepth |
conditions are extracted from the top maxdepth levels from each tree |
random |
the max depth for each tree is an integer randomly chosen between 1 and maxdepth |
digits |
digits for rounding |
a set of rule conditions
library(RRF) data(iris) X <- iris[,1:(ncol(iris)-1)] target <- iris[,"Species"] rf <- RRF(X,as.factor(target),ntree=100) # build an ordinary RF treeList <- RF2List(rf) ruleExec <- extractRules(treeList,X,digits=4) # transform to R-executable rules ruleExec <- unique(ruleExec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.