buildLearner | R Documentation |
Build a simplified tree ensemble learner (STEL). Currently works only for classification problems.
buildLearner(ruleMetric, X, target, minFreq = 0.01)
ruleMetric |
a matrix including the conditions, predictions, and and metrics |
X |
predictor variable matrix |
target |
target variable |
minFreq |
minimum frequency of a rule condition in order to be included in STEL. |
a matrix including the conditions, prediction, and metrics, ordered by priority.
Houtao Deng
Houtao Deng, Interpreting Tree Ensembles with inTrees, technical report, 2014
data(iris) library(RRF) 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) ruleExec <- unique(ruleExec) ruleMetric <- getRuleMetric(ruleExec,X,target) # measure rules ruleMetric <- pruneRule(ruleMetric,X,target) # prune each rule #ruleMetric <- selectRuleRRF(ruleMetric,X,target) # rule selection learner <- buildLearner(ruleMetric,X,target) pred <- applyLearner(learner,X) read <- presentRules(learner,colnames(X)) # more readable format # format the rule and metrics as a table in latex code library(xtable) print(xtable(read), include.rownames=FALSE) print(xtable(ruleMetric[1:2,]), include.rownames=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.