Categories &

Functions List

Class Definition: ClassificationBaggedEnsemble

statistics: ClassificationBaggedEnsemble

Bagged ensemble of decision trees for classification

A ClassificationBaggedEnsemble object holds decision trees each grown on a sample drawn from the training data in proportion to the observation weights, each split chosen from ceil (sqrt (P)) predictors drawn afresh at every node. It predicts by averaging its trees’ class probabilities.

Create one with fitcensemble and 'Method' set to 'Bag'. It carries everything a ClassificationEnsemble does, and which rows each tree drew. A boosting method that resamples, asked for with 'Resample', 'FResample' or 'Replace', returns this class too: its trees are boosted and summed by their weights, each grown on the rows it drew.

See also: fitcensemble, ClassificationEnsemble, CompactClassificationEnsemble, TreeBagger

Source Code: ClassificationBaggedEnsemble

The ClassificationBaggedEnsemble class contains the following properties:

A number greater than 0 and no greater than 1, each tree drawing ceil (FResample * N) observations. This property is read-only.

A logical scalar, true by default. This property is read-only.

An NxNumTrained logical matrix, true where a tree’s sample holds an observation. This property is read-only.

The predictors the ensemble was fitted on, one row per observation, a row missing a value or a class having been left out. This property is read-only.

The labels the ensemble was fitted on, in the type they were given in. This property is read-only.

A logical column over the rows as supplied. This property is read-only.

The weights given, scaled so that the observations of each class sum to its prior probability. A cost matrix is not folded into them. This property is read-only.

A structure with the fields Type, Method, LearnerTemplates, the tree template the learners were grown from, NLearn, the number of learning cycles asked for in all, and LearnRate. This property is read-only.

This property is read-only.

Always empty, binning not being implemented. This property is read-only.

Always empty, such optimization not being implemented. This property is read-only.

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

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

This property is read-only.

The same as PredictorNames. This property is read-only.

The classes, in the type of the response, sorted or in the order given by the 'ClassNames' option; the columns of the scores take them in that order. This property is read-only.

A row vector with one probability per class. This property is read-only.

A square matrix, Cost(i,j) being the cost of classifying an observation of class i as class j. A boosting method starts from observation weights multiplied by the total cost of misclassifying each observation’s class. This property is read-only.

'AdaBoostM1', 'AdaBoostM2', 'GentleBoost', 'LogitBoost', 'RUSBoost', 'LPBoost', 'TotalBoost', 'Bag' or 'Subspace'. This property is read-only.

{'Tree'}, or for Subspace {'KNN'} or {'Discriminant'}. This property is read-only.

A character vector. This property is read-only.

A column with one element per learner: the weighted classification error for AdaBoostM1, the weighted pseudo-loss for AdaBoostM2 and RUSBoost, and the weighted mean squared error of the regression tree for GentleBoost and LogitBoost. For LPBoost and TotalBoost a matrix with a row per learner: its margin on each observation, and its edge last. Empty for Bag. This property is read-only.

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.

This property is read-only.

A column cell array of compact trees, as described under CompactClassificationEnsemble.Trained. This property is read-only.

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

'WeightedSum' for boosting, 'WeightedAverage' for Bag. This property is read-only.

See CompactClassificationEnsemble.ScoreTransform.

The ClassificationBaggedEnsemble class offers the following public methods:

ClassificationBaggedEnsemble: obj = ClassificationBaggedEnsemble (X, Y)
ClassificationBaggedEnsemble: obj = ClassificationBaggedEnsemble (…, name, value)

fitcensemble with 'Method' set to 'Bag' is the documented way in, and its help lists the options both take.

See also: fitcensemble, ClassificationEnsemble

ClassificationBaggedEnsemble: CVMdl = crossval (obj)
ClassificationBaggedEnsemble: CVMdl = crossval (…, name, value)

Behaves as ClassificationEnsemble.crossval, returning a ClassificationPartitionedEnsemble.

See also: ClassificationBaggedEnsemble, ClassificationPartitionedEnsemble

ClassificationBaggedEnsemble: CMdl = compact (obj)

Returns a CompactClassificationEnsemble, as ClassificationEnsemble.compact does.

See also: ClassificationBaggedEnsemble, CompactClassificationEnsemble

ClassificationBaggedEnsemble: B = resume (obj, NumLearningCycles)
ClassificationBaggedEnsemble: B = resume (…, ’NPrint’, n)

Behaves as ClassificationEnsemble.resume, the new trees’ samples added to UseObsForLearner.

See also: ClassificationBaggedEnsemble, ClassificationEnsemble.resume

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

Behaves as CompactClassificationEnsemble.predict.

See also: ClassificationBaggedEnsemble, CompactClassificationEnsemble.predict

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

Behaves as CompactClassificationEnsemble.loss.

See also: ClassificationBaggedEnsemble, CompactClassificationEnsemble.loss

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

Behaves as CompactClassificationEnsemble.edge.

See also: ClassificationBaggedEnsemble, CompactClassificationEnsemble.edge

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

Behaves as CompactClassificationEnsemble.margin.

See also: ClassificationBaggedEnsemble, CompactClassificationEnsemble.margin

ClassificationBaggedEnsemble: label = resubPredict (obj)
ClassificationBaggedEnsemble: [label, scores] = resubPredict (…)

Behaves as ClassificationEnsemble.resubPredict.

See also: ClassificationBaggedEnsemble, ClassificationEnsemble.resubPredict

ClassificationBaggedEnsemble: L = resubLoss (obj)
ClassificationBaggedEnsemble: L = resubLoss (…, name, value)

Behaves as ClassificationEnsemble.resubLoss.

See also: ClassificationBaggedEnsemble, ClassificationEnsemble.resubLoss

ClassificationBaggedEnsemble: e = resubEdge (obj)
ClassificationBaggedEnsemble: e = resubEdge (…, name, value)

Behaves as ClassificationEnsemble.resubEdge.

See also: ClassificationBaggedEnsemble, ClassificationEnsemble.resubEdge

ClassificationBaggedEnsemble: m = resubMargin (obj)
ClassificationBaggedEnsemble: m = resubMargin (…, name, value)

Behaves as ClassificationEnsemble.resubMargin.

See also: ClassificationBaggedEnsemble, ClassificationEnsemble.resubMargin

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

The mean over the trees of each tree’s predictorImportance, as CompactClassificationEnsemble.predictorImportance computes it.

See also: ClassificationBaggedEnsemble, ClassificationBaggedEnsemble.oobPermutedPredictorImportance

ClassificationBaggedEnsemble: label = oobPredict (obj)
ClassificationBaggedEnsemble: [label, scores] = oobPredict (…)
ClassificationBaggedEnsemble: […] = oobPredict (…, ’Learners’, idx)

Each training observation is classified by the trees whose samples left it out, as predict classifies it with 'UseObsForLearner' set to ! UseObsForLearner. An observation in the sample of every tree used has NaN scores and is given the class of greatest prior probability. 'Learners' restricts the trees.

See also: ClassificationBaggedEnsemble, ClassificationBaggedEnsemble.oobLoss

ClassificationBaggedEnsemble: L = oobLoss (obj)
ClassificationBaggedEnsemble: L = oobLoss (…, name, value)

The loss of the out-of-bag scores against Y, weighted by W, an observation in the sample of every tree used being left out. 'LossFun' and 'Mode' are taken as by CompactClassificationEnsemble.loss, and 'Learners' restricts the trees.

See also: ClassificationBaggedEnsemble, ClassificationBaggedEnsemble.oobPredict

ClassificationBaggedEnsemble: e = oobEdge (obj)
ClassificationBaggedEnsemble: e = oobEdge (…, name, value)

The weighted mean of the out-of-bag margins, weighted by W. 'Mode' and 'Learners' are taken as by oobLoss.

See also: ClassificationBaggedEnsemble, ClassificationBaggedEnsemble.oobMargin

ClassificationBaggedEnsemble: m = oobMargin (obj)
ClassificationBaggedEnsemble: m = oobMargin (…, ’Learners’, idx)

The margin of each training observation under its out-of-bag scores, NaN for one in the sample of every tree used.

See also: ClassificationBaggedEnsemble, ClassificationBaggedEnsemble.oobEdge

ClassificationBaggedEnsemble: imp = oobPermutedPredictorImportance (obj)
ClassificationBaggedEnsemble: imp = oobPermutedPredictorImportance (…, ’Learners’, idx)

For each tree, the values of each predictor are permuted among the observations out of its bag, and the tree’s misclassification rate on them, weighted by W, is taken before and after. imp holds, for each predictor, the mean of the rise over the trees divided by its standard deviation over the trees, zero where the mean is zero. 'Learners' restricts the trees.

See also: ClassificationBaggedEnsemble, ClassificationBaggedEnsemble.predictorImportance