Main Content

resubEdge

Resubstitution classification edge for classification ensemble model

Description

example

edge = resubEdge(ens) returns the resubstitution Classification Edge (edge) for the trained classification ensemble model ens using the training data stored in ens.X and the corresponding true class labels stored in ens.Y. The classification edge is the Classification Margin averaged over the entire data set. edge can be a scalar or vector, depending on the setting of the Mode name-value argument.

edge = resubEdge(ens,Name=Value) specifies additional options using one or more name-value arguments. For example, you can specify the indices of the weak learners to use for calculating the loss, select the aggregation level for the output, and perform computations in parallel.

Input Arguments

expand all

Classification ensemble model, specified as a ClassificationEnsemble model object trained with fitcensemble.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: resubEdge(ens,Learners=[1 2 3 5],UseParallel=true) specifies to use the first, second, third, and fifth learners in the ensemble in resubEdge, and to perform computations in parallel.

Indices of weak learners in the ensemble to use in resubEdge, specified as a vector of positive integers in the range [1:ens.NumTrained]. By default, all learners are used.

Example: Learners=[1 2 4]

Data Types: single | double

Aggregation level for the output, specified as "ensemble", "individual", or "cumulative".

ValueDescription
"ensemble"The output is a scalar value, the loss for the entire ensemble.
"individual"The output is a vector with one element per trained learner.
"cumulative"The output is a vector in which element J is obtained by using learners 1:J from the input list of learners.

Example: Mode="individual"

Data Types: char | string

Flag to run in parallel, specified as a numeric or logical 1 (true) or 0 (false). If you specify UseParallel=true, the resubEdge function executes for-loop iterations by using parfor. The loop runs in parallel when you have Parallel Computing Toolbox™.

Example: UseParallel=true

Data Types: logical

Examples

expand all

Find the resubstitution edge for an ensemble that classifies the Fisher iris data.

Load the sample data set.

load fisheriris

Train an ensemble of 100 boosted classification trees using AdaBoostM2.

t = templateTree(MaxNumSplits=1); % Weak learner template tree object
ens = fitcensemble(meas,species,"Method","AdaBoostM2","Learners",t);

Find the resubstitution edge.

edge = resubEdge(ens) 
edge = 3.2486

More About

expand all

Extended Capabilities

Version History

Introduced in R2011a

expand all