Categories &

Functions List

Class Definition: CompactRegressionEnsemble

statistics: CompactRegressionEnsemble

Compact ensemble of regression trees

A CompactRegressionEnsemble object carries the trained trees of a boosted or bagged regression 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 trees can be removed from it.

Create one with the compact method of a RegressionEnsemble or RegressionBaggedEnsemble object.

See also: fitrensemble, RegressionEnsemble, RegressionBaggedEnsemble

Source Code: CompactRegressionEnsemble

The CompactRegressionEnsemble class contains the following properties:

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.

Always empty, as MATLAB returns it for tree learners. This property is read-only.

This property is read-only.

A column cell array of CompactRegressionTree objects. This property is read-only.

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

'WeightedSum' for LSBoost, whose prediction is the sum of each tree’s prediction times its weight, or 'WeightedAverage' for Bag, whose prediction is the weighted average of its trees’. This property is read-only.

'none' (default), 'exp', 'log' or a function handle. Predictions and losses use the transformed response.

The CompactRegressionEnsemble class offers the following public methods:

CompactRegressionEnsemble: yfit = predict (obj, X)
CompactRegressionEnsemble: yfit = predict (…, name, value)

yfit holds, for each row of X, the sum over the trees of each tree’s prediction times its weight for LSBoost, or the weighted average of the trees’ predictions for Bag, after ResponseTransform. A row that no tree may predict is NaN.

Name-Value arguments:

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

See also: CompactRegressionEnsemble, fitrensemble

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

L is the weighted mean squared error of the predictions for the rows of X against Y, the weights normalized to sum to one over the rows that have a response; a row whose response is missing is left out.

Name-Value arguments:

NameValue
'LossFun''mse' (default) or a function handle called as lossfun (Y, Yfit, W), with column vectors of the responses, the predictions and the normalized weights, returning a scalar.
'Mode''ensemble' (default) for one loss over the trees 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 that no tree may predict is left out and the weights are renormalized over the rest.

See also: CompactRegressionEnsemble, CompactRegressionEnsemble.predict

CompactRegressionEnsemble: imp = predictorImportance (obj)
CompactRegressionEnsemble: [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. ma, the predictive measure of association between the predictors, is empty, the trees growing no surrogate splits.

See also: CompactRegressionEnsemble

CompactRegressionEnsemble: C = removeLearners (obj, idx)

C is the ensemble without the trees whose indices idx holds, their weights removed with them.

See also: CompactRegressionEnsemble