Main Content

resubEdge

Resubstitution classification edge for classification ensemble model

Description

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.

example

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.

Examples

collapse 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

Input Arguments

collapse all

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

Name-Value Arguments

collapse all

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 the weak learners in the ensemble to use with resubEdge, specified as a vector of positive integers in the range [1:ens.NumTrained]. By default, the function uses all learners.

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

More About

collapse all

Extended Capabilities

expand all

Version History

Introduced in R2011a

expand all