Main Content

oobMargin

Out-of-bag margins

Syntax

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

Description

mar = oobMargin(B) computes an Nobs-by-NTrees matrix of classification margins for out-of-bag observations in the training data, using the trained bagger B.

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

'Mode'Character vector or string scalar indicating how oobMargin computes errors. If set to 'cumulative' (default), the method computes cumulative margins and mar is an Nobs-by-NTrees matrix, where the first column gives margins from trees(1), second column gives margins from trees(1:2) etc., up to trees(1:NTrees). If set to 'individual', mar is an Nobs-by-NTrees matrix, where each column gives margins from each tree in the ensemble. If set to 'ensemble', mar is a single column of length Nobs showing the cumulative margins 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 an Nobs-by-NTrees matrix for 'cumulative' and 'individual' modes, where NTrees is the number of elements in the input vector, and a single column for 'ensemble' mode. For example, in the 'cumulative' mode, the first column gives margins from trees(1), the second column gives margins from trees(1:2) etc.
'TreeWeights'Vector of tree weights. This vector must have the same length as the 'Trees' vector. oobMargin 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.

See Also