Main Content


Out-of-bag classification edge


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


edge = oobEdge(ens) returns out-of-bag classification edge for ens.

edge = oobEdge(ens,Name,Value) computes classification 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

expand all


A classification bagged ensemble, constructed 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.

Indices of weak learners in the ensemble to use in oobEdge, 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

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

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

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

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

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.

Output Arguments


Classification edge, a weighted average of the classification margin.


expand all

Load Fisher's iris data set.

load fisheriris

Train an ensemble of 100 bagged classification trees using the entire data set.

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

Estimate the out-of-bag edge.

edge = oobEdge(Mdl)
edge = 0.8767

More About

expand all

Extended Capabilities

Version History

expand all