This is machine translation

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


Class: CompactClassificationEnsemble

Classification edge


E = edge(ens,tbl,ResponseVarName)
E = edge(ens,tbl,Y)
E = edge(ens,X,Y)
E = edge(___,Name,Value)


E = edge(ens,tbl,ResponseVarName) returns the classification edge for ens with data tbl and classification tbl.ResponseVarName.

E = edge(ens,tbl,Y) returns the classification edge for ens with data tbl and classification Y.

E = edge(ens,X,Y) returns the classification edge for ens with data X and classification Y.

E = edge(___,Name,Value) computes the edge with additional options specified by one or more Name,Value pair arguments, using any of the previous syntaxes.

Input Arguments


A classification ensemble constructed with fitensemble, or a compact classification ensemble constructed with compact.


Sample data, specified as a table. Each row of tbl corresponds to one observation, and each column corresponds to one predictor variable. tbl must contain all of the predictors used to train the model. Multi-column variables and cell arrays other than cell arrays of character vectors are not allowed.

If you trained ens using sample data contained in a table, then the input data for this method must also be in a table.


Response variable name, specified as the name of a variable in tbl. The response variable must be a numeric vector.

You must specify ResponseVarName as a character vector. For example, if the response variable Y is stored as tbl.Y, then specify it as 'Y'. Otherwise, the software treats all columns of tbl, including Y, as predictors when training the model.


A matrix where each row represents an observation, and each column represents a predictor. The number of columns in X must equal the number of predictors in ens.

If you trained ens using sample data contained in a matrix, then the input data for this method must also be in a matrix.


Class labels, with the same data type as exists in ens. The number of elements of Y must equal the number of rows of tbl or X.

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.


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

Default: 1:NumTrained


Meaning of the output E:

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

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

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

Default: 'ensemble'


A logical matrix of size N-by-T, where:

  • N is the number of rows of X.

  • T is the number of weak learners in ens.

When UseObsForLearner(i,j) is true, learner j is used in predicting the class of row i of X.

Default: true(N,T)


Observation weights, a numeric vector of length size(X,1). If you supply weights, edge computes weighted classification edge.

Default: ones(size(X,1))

Output Arguments


The classification edge, a vector or scalar depending on the setting of the mode name-value pair. Classification edge is weighted average classification margin.



The classification margin is the difference between the classification score for the true class and maximal classification score for the false classes. Margin is a column vector with the same number of rows as in the matrix X.

Score (ensemble)

For ensembles, a classification score represents the confidence of a classification into a class. The higher the score, the higher the confidence.

Different ensemble algorithms have different definitions for their scores. Furthermore, the range of scores depends on ensemble type. For example:

  • AdaBoostM1 scores range from –∞ to ∞.

  • Bag scores range from 0 to 1.


The edge is the weighted mean value of the classification margin. The weights are the class probabilities in ens.Prior. If you supply weights in the weights name-value pair, those weights are used instead of class probabilities.


Make a boosted ensemble classifier for the ionosphere data, and find the classification edge for the last few rows:

load ionosphere
ens = fitensemble(X,Y,'AdaboostM1',100,'Tree');
E = edge(ens,X(end-10:end,:),Y(end-10:end))

E =

See Also


Was this topic helpful?