Description Usage Arguments Value Author(s) Examples
computes importance scores for an individual tree.
These can be based on Gini impurity or Accuracy or logloss
1 2 3 4 5 6 7 8 9 10 11 12 13 |
inbag |
inbag data |
outbag |
|
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 |
correctBias |
multiply by n/(n-1) for sample variance correction! |
ImpTypes |
which scores should be computed |
verbose |
level of verbosity |
if returnTree==TRUE returns the tree data frame otherwise the aggregated Gini importance grouped by split variables
Markus Loecher <Markus.Loecher@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | rfTit = rfTitanic(nRows = 500,nodesize=10)
rfTit$data$Survived = as.numeric(rfTit$data$Survived)-1
k=1
inbag = rep(rownames(rfTit$RF$inbag),time=rfTit$RF$inbag[,k])
#trainBag=titanic_train[inbag,]
trainBag=rfTit$data[inbag,];rownames(trainBag) = 1:nrow(trainBag)
outbag = names((rfTit$RF$inbag[rfTit$RF$inbag[,k]==0,k]))
OOB = rfTit$data[outbag,];rownames(OOB) = 1:nrow(OOB)
Imp =GiniImportanceTree(trainBag,OOB, RF,k,ylabel="Survived")
Tree = GiniImportanceTree(trainBag,OOB, RF,k,ylabel="Survived",returnTree=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.