Syntax
Y = oobPredict(B)
Y = oobPredict(B,'param1',val1,'param2',val2,...)
Description
Y = oobPredict(B)
computes predicted responses using the trained baggerB
for out-of-bag observations in the training data. The output has one prediction for each observation in the training data. The returned Y is a cell array of character vectors for classification and a numeric array for regression.
Y = oobPredict(B,'param1',val1,'param2',val2,...)
specifies optional parameter name/value pairs:
'Trees' |
Array of tree indices to use for computation of responses. Default is'all' . |
'TreeWeights' |
Array ofNTrees weights for weighting votes from the specified trees. |
Algorithms
oobPredict
andpredict
similarly predict classes and responses.
In regression problems:
For each observation that is out of bag for at least one tree,
oobPredict
composes the weighted mean by selecting responses of trees in which the observation is out of bag. For this computation, the'TreeWeights'
name-value pair argument specifies the weights.对每个观察包所有的树木,the predicted response is the weighted mean of all of the training responses. For this computation, the
W
property of theTreeBagger
model (i.e., the observation weights) specify the weights.
In classification problems:
For each observation that is out of bag for at least one tree,
oobPredict
composes the weighted mean of the class posterior probabilities by selecting the trees in which the observation is out of bag. Consequently, the predicted class is the class corresponding to the largest weighted mean. For this computation, the'TreeWeights'
name-value pair argument specifies the weights.对每个观察包所有的树木,the predicted class is the weighted, most popular class over all training responses. For this computation, the
W
property of theTreeBagger
model (i.e., the observation weights) specify the weights. If there are multiple most popular classes,oobPredict
considers the one listed first in theClassNames
property of theTreeBagger
model the most popular.