Main Content

resubEdge

Classification edge by resubstitution

Syntax

edge = resubEdge(ens)
edge = resubEdge(ens,Name,Value)

Description

edge = resubEdge(ens) returns the classification edge obtained by ens on its training data.

edge = resubEdge(ens,Name,Value) calculates edge with additional options specified by one or more Name,Value pair arguments. You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.

Input Arguments

ens

A classification ensemble created 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.

learners

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

Default: 1:NumTrained

mode

Character vector or string scalar representing the meaning of the output edge:

  • 'ensemble'edge is a scalar value, the loss for the entire ensemble.

  • 'individual'edge is a vector with one element per trained learner.

  • 'cumulative'edge is a vector in which element J is obtained by using learners 1:J from the input list of learners.

Default: 'ensemble'

UseParallel

Indication to perform inference in parallel, specified as false (compute serially) or true (compute in parallel). Parallel computation requires Parallel Computing Toolbox™. Parallel inference can be faster than serial inference, especially for large datasets. Parallel computation is supported only for tree learners.

Default: false

Output Arguments

edge

Classification edge obtained by ens by resubstituting the training data into the calculation of edge. Classification edge is classification margin averaged over the entire data. edge can be a scalar or vector, depending on the setting of the mode name-value pair.

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

expand all

Behavior changed in R2022a