Categories &

Functions List

Class Definition: CompactClassificationEnsemble

statistics: CompactClassificationEnsemble

Compact ensemble of weak learners for classification

A CompactClassificationEnsemble object carries the trained weak learners of a boosted or bagged ensemble and what prediction needs, but not the observations it was fitted on. It predicts new data identically to the ensemble it came from, and weak learners can be removed from it.

Create one with the compact method of a ClassificationEnsemble or ClassificationBaggedEnsemble object.

See also: fitcensemble, ClassificationEnsemble, ClassificationBaggedEnsemble

Source Code: CompactClassificationEnsemble

The CompactClassificationEnsemble class contains the following properties:

The predictors every tree treats as categorical, empty when none is. This property is read-only.

The classes, in the type of the response and in the order the columns of the scores take them. This property is read-only.

'WeightedSum' for a boosted ensemble, whose scores are the sum of each learner’s output times its weight, or 'WeightedAverage' for a bagged one, whose scores are the weighted average of its trees’ class probabilities. This property is read-only.

A square matrix, Cost(i,j) being the cost of classifying an observation of class i as class j. This property is read-only.

The same as PredictorNames, no predictor being expanded. This property is read-only.

A nonnegative integer. This property is read-only.

A cell array of character vectors. This property is read-only.

A row vector with one probability per class, in the order of ClassNames. This property is read-only.

A character vector. This property is read-only.

A column cell array with one compact model per learner: a CompactClassificationTree for AdaBoostM1, AdaBoostM2, RUSBoost and Bag, and a CompactRegressionTree for GentleBoost and LogitBoost, which fit regression trees. MATLAB wraps those regression trees in a classifier object of its own; here they are held as they are. This property is read-only.

A column with one weight per learner. This property is read-only.

For the 'Subspace' method, a logical matrix with one row per predictor and one column per learner. Empty for tree learners, as MATLAB returns it. This property is read-only.

A character vector naming a built-in transform, such as 'none' (default) or 'doublelogit', or a function handle. The labels, losses, edges and margins are computed from the transformed scores.

The CompactClassificationEnsemble class offers the following public methods:

CompactClassificationEnsemble: label = predict (obj, X)
CompactClassificationEnsemble: [label, scores] = predict (…)
CompactClassificationEnsemble: […] = predict (…, name, value)

label holds the class of highest score for each row of X, in the type of ClassNames, and scores the NxK scores after ScoreTransform.

The scores of a boosted ensemble are the sum over the learners of each learner’s weight times its output. For AdaBoostM1 the output is +1 for the class the learner predicts and -1 for the other; for GentleBoost and LogitBoost it is the regression tree’s prediction for the first class and its negative for the second; for AdaBoostM2 and RUSBoost it is the learner’s class probabilities. The scores of a bagged ensemble are the average of its trees’ class probabilities. A row that no learner may score has NaN scores and is given the class of greatest prior probability.

Name-Value arguments:

NameValue
'Learners'A vector of indices of the learners to use. The default is all of them.
'UseObsForLearner'An NxNumTrained logical matrix saying which learner may score which row. The default lets every learner score every row.

See also: CompactClassificationEnsemble, fitcensemble

CompactClassificationEnsemble: L = loss (obj, X, Y)
CompactClassificationEnsemble: L = loss (…, name, value)

L is the weighted loss of the scores predict gives the rows of X against the labels Y. The weights are normalized so that each class carries its prior probability.

Name-Value arguments:

NameValue
'LossFun''classiferror' (default), 'binodeviance', 'classifcost', 'exponential', 'hinge', 'logit', 'mincost', 'quadratic', or a function handle called as lossfun (C, S, W, Cost), C being an NxK logical matrix marking each row’s class, S the scores and W the normalized weights.
'Mode''ensemble' (default) for one loss over the learners used, 'cumulative' for a column whose element j uses the first j of them, or 'individual' for a column with the loss of each on its own.
'Weights'A nonnegative vector with one weight per row. The default is uniform.

'Learners' and 'UseObsForLearner' are taken as by predict. A row with NaN scores, which no learner may score, is left out and the weights are renormalized over the rest; edge does the same.

See also: CompactClassificationEnsemble, CompactClassificationEnsemble.edge

CompactClassificationEnsemble: e = edge (obj, X, Y)
CompactClassificationEnsemble: e = edge (…, name, value)

e is the weighted mean of the margins of the rows of X, the weights normalized so that each class carries its prior probability. 'Mode' and 'Weights' are taken as by loss, and 'Learners' and 'UseObsForLearner' as by predict.

See also: CompactClassificationEnsemble, CompactClassificationEnsemble.margin

CompactClassificationEnsemble: m = margin (obj, X, Y)
CompactClassificationEnsemble: m = margin (…, name, value)

m holds, for each row of X, the score of its true class less the highest score among the other classes. 'Learners' and 'UseObsForLearner' are taken as by predict.

See also: CompactClassificationEnsemble, CompactClassificationEnsemble.edge

CompactClassificationEnsemble: imp = predictorImportance (obj)
CompactClassificationEnsemble: [imp, ma] = predictorImportance (obj)

imp is a row vector with one element per predictor, the average over the trees of each tree’s predictorImportance, weighted by TrainedWeights. GentleBoost and LogitBoost ensembles take the importance of their regression trees. ma, the predictive measure of association between the predictors, is empty, the trees growing no surrogate splits.

See also: CompactClassificationEnsemble

CompactClassificationEnsemble: C = removeLearners (obj, idx)

C is the ensemble without the learners whose indices idx holds, their weights and their columns of UsePredForLearner removed with them.

See also: CompactClassificationEnsemble