GiniImportanceTree {rfVarImpOOB} | R Documentation |
computes Gini information gain for one tree from randomForest
Description
computes importance scores for an individual tree.
These can be based on Gini impurity or Accuracy or logloss
Usage
GiniImportanceTree(bag, RF, k, ylabel = "Survived", returnTree = FALSE,
zeroLeaf = TRUE, score = c("PMDI21", "MDI", "MDA", "MIA")[1],
Predictor = Mode, verbose = 0)
Arguments
bag |
data to compute the Gini gain for |
RF |
object returned by call to randomForest() |
k |
which tree |
ylabel |
name of dependent variable |
returnTree |
if TRUE returns the tree data frame otherwise the aggregated Gini importance grouped by split variables |
zeroLeaf |
if TRUE discard the information gain due to splits resulting in n=1 |
score |
scoring method:PMDI=mean decrease penalized Gini impurity (note:the last digit is the exponent of the penalty!), MDI=mean decrease impurity (Gini), MDA=mean decrease accuracy (permutation), MIA=mean increase accuracy |
Predictor |
function to estimate node prediction, such as Mode or mean or median. Alternatively, pass an array of numbers as replacement for the yHat column of tree |
verbose |
level of verbosity |
Value
if returnTree==TRUE returns the tree data frame otherwise the aggregated Gini importance grouped by split variables
Author(s)
Markus Loecher <Markus.Loecher@gmail.com>
Examples
rfTit = rfTitanic(nRows = 500,nodesize=10)
rfTit$data$Survived = as.numeric(rfTit$data$Survived)-1
k=1
tmp <- InOutBags(rfTit$RF, rfTit$data, k)
IndivTree =getTree(rfTit$RF,k)
#plot(as.party(tmp))#does not work
InTree = GiniImportanceTree(tmp$inbag,rfTit$RF,k,returnTree=TRUE)
OutTree = GiniImportanceTree(tmp$outbag,rfTit$RF,k,returnTree=TRUE)