Description Usage Arguments Value Examples
View source: R/holdoutNodePerformance.R
Uses bootstrap sampling to get average loss for each observation. We do this
by averaging outofbag loss over a number of runs for each data point. Each insample
tree is fit using the same settings as model_tree.obj
.
1 2 3 
model_tree.obj 
An 
data 
A data frame – we construct risk estimates for each row of in this frame by looking at average outofbag loss. 
nboot 
Number of bootrap/crossvalidation runs. 
sampleFcn 
Any function that takes a vector of indices (1,...,N) where

minsplit 
Specifies the 
minbucket 
Same as 
lossfcn 
A function that takes two vectors, 
A list with elements:
bagpred
= Average predictions for all N observations over all nboot
runs. For
classification it is the most common class.
holdout.predictions
= An N x nboot
matrix with holdout predictions
for each run along the columns. If observation i
is in the learning sample for run j, then
holdout.predicitions[i,j]
is NA
.
avgOOBloss
= N x 1
vector of average OOB loss.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  require(mlbench); data(BostonHousing)
#fit a tree:
cart < itree(medv~.,BostonHousing,minsplit=25,minbucket=25,cp=0)
#generate thetahat values by computing average outofbag loss:
## Not run:
theta_hats < getOOBLoss(model_tree.obj=cart.bh,data=bh,nboot=100)
# Then for each leaf we estimate local risk by the mean innode thetahat.
lre < estNodeRisk(tree.obj=cart.bh,est_observation_loss=theta_hats$avgOOBloss)
# to add the lre to the plot:
plot(cart.bh, do_node_re= TRUE, uniform=TRUE)
text(cart.bh, est_node_risk = lre)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.