oobMargin

Out-of-bag classification margins

Syntax

margin = oobMargin(ens)
margin = oobMargin(ens,Name,Value)

Description

margin = oobMargin(ens) returns out-of-bag classification margins.

margin = oobMargin(ens,Name,Value) calculates margins with additional options specified by one or more Name,Value pair arguments.

Input Arguments

ens

A classification bagged ensemble, constructed with fitcensemble.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'learners'

Indices of weak learners in the ensemble ranging from 1 to ens.NumTrained. oobEdge uses only these learners for calculating loss.

Default: 1:NumTrained

Output Arguments

margin

A numeric column vector of length size(ens.X,1).

Examples

expand all

Find the out-of-bag margins for a bagged ensemble from the Fisher iris data.

Load the sample data set.

load fisheriris

Train an ensemble of bagged classification trees.

ens = fitcensemble(meas,species,'Method','Bag');

Find the number of out-of-bag margins that are equal to 1.

margin = oobMargin(ens);
sum(margin == 1)
ans = 109

More About

expand all