Main Content

oobMeanMargin

Out-of-bag mean margins

Syntax

mar = oobMeanMargin(B)
mar = oobMeanMargin(B,'param1',val1,'param2',val2,...)

Description

mar = oobMeanMargin(B) computes average classification margins for out-of-bag observations in the training data, using the trained bagger B. oobMeanMargin averages the margins over all out-of-bag observations. mar is a row-vector of length NTrees, where NTrees is the number of trees in the ensemble.

mar = oobMeanMargin(B,'param1',val1,'param2',val2,...) specifies optional parameter name/value pairs:

'Mode'Character vector or string scalar indicating how oobMeanMargin computes errors. If set to 'cumulative' (default), is a vector of length NTrees where the first element gives mean margin from trees(1), second column gives mean margins from trees(1:2) etc., up to trees(1:NTrees). If set to 'individual', mar is a vector of length NTrees, where each element is a mean margin from each tree in the ensemble. If set to 'ensemble', mar is a scalar showing the cumulative mean margin for the entire ensemble.
'Trees'Vector of indices indicating what trees to include in this calculation. By default, this argument is set to 'all' and the method uses all trees. If 'Trees' is a numeric vector, the method returns a vector of length NTrees for 'cumulative' and 'individual' modes, where NTrees is the number of elements in the input vector, and a scalar for 'ensemble' mode. For example, in the 'cumulative' mode, the first element gives mean margin from trees(1), the second element gives mean margin from trees(1:2) etc.
'TreeWeights'Vector of tree weights. This vector must have the same length as the 'Trees' vector. oobMeanMargin uses these weights to combine output from the specified trees by taking a weighted average instead of the simple nonweighted majority vote. You cannot use this argument in the 'individual' mode.

Version History

expand all

See Also