L = resubLoss(tree)
L = resubLoss(tree,Name,Value)
L = resubLoss(tree,'Subtrees',subtreevector)
[L,se] =
resubLoss(tree,'Subtrees',subtreevector)
[L,se,NLeaf]
= resubLoss(tree,'Subtrees',subtreevector)
[L,se,NLeaf,bestlevel]
= resubLoss(tree,'Subtrees',subtreevector)
[L,...] = resubLoss(tree,'Subtrees',subtreevector,Name,Value)
returns
the resubstitution loss, meaning the loss computed for the data that L
= resubLoss(tree
)fitrtree
used to create tree
.
returns
the loss with additional options specified by one or more L
= resubLoss(tree
,Name,Value
)Name,Value
pair
arguments. You can specify several namevalue pair arguments in any
order as Name1,Value1,…,NameN,ValueN
.
returns
a vector of mean squared errors for the trees in the pruning sequence L
= resubLoss(tree
,'Subtrees'
,subtreevector)subtreevector
.
[
returns
the vector of standard errors of the classification errors.L
,se
] =
resubLoss(tree
,'Subtrees'
,subtreevector)
[
returns
the vector of numbers of leaf nodes in the trees of the pruning sequence.L
,se
,NLeaf
]
= resubLoss(tree
,'Subtrees'
,subtreevector)
[
returns
the best pruning level as defined in the L
,se
,NLeaf
,bestlevel
]
= resubLoss(tree
,'Subtrees'
,subtreevector)TreeSize
namevalue
pair. By default, bestlevel
is the pruning level
that gives loss within one standard deviation of minimal loss.
[L,...] = resubLoss(
returns
loss statistics with additional options specified by one or more tree
,'Subtrees'
,subtreevector,Name,Value
)Name,Value
pair
arguments. You can specify several namevalue pair arguments in any
order as Name1,Value1,…,NameN,ValueN
.

Mean squared error, a vector the length of 

Standard error of loss, a vector the length of 

Number of leaves (terminal nodes) in the pruned subtrees, a
vector the length of 

A scalar whose value depends on

The builtin loss function is 'mse'
, meaning
mean squared error.
To write your own loss function, create a function file of the form
function loss = lossfun(Y,Yfit,W)
N
is the number of rows of tree
.X
.
Y
is an N
element
vector representing the observed response.
Yfit
is an N
element
vector representing the predicted responses.
W
is an N
element
vector representing the observation weights.
The output loss
should be a scalar.
Pass the function handle @
as
the value of the lossfun
LossFun
namevalue pair.
fitrtree
 loss
 resubPredict