Documentation

oobPredict

Class:TreeBagger

Ensemble predictions for out-of-bag observations

Syntax

Y = oobPredict(B)
Y = oobPredict(B,'param1',val1,'param2',val2,...)

Description

Y = oobPredict(B)computes predicted responses using the trained baggerBfor 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 ofNTreesweights for weighting votes from the specified trees.

Algorithms

oobPredictandpredictsimilarly predict classes and responses.

  • In regression problems:

    • For each observation that is out of bag for at least one tree,oobPredictcomposes 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, theWproperty of theTreeBaggermodel (i.e., the observation weights) specify the weights.

  • In classification problems:

    • For each observation that is out of bag for at least one tree,oobPredictcomposes 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, theWproperty of theTreeBaggermodel (i.e., the observation weights) specify the weights. If there are multiple most popular classes,oobPredictconsiders the one listed first in theClassNamesproperty of theTreeBaggermodel the most popular.

Was this topic helpful?