Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

oobMargin

Class: ClassificationBaggedEnsemble

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 single 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.

rng(10,'twister') % For reproducibility
margin = oobMargin(ens);
sum(margin == 1)
ans = 110

Definitions

expand all

Was this topic helpful?