CompactRegressionEnsemble class

Compact regression ensemble class

Description

Compact version of a regression ensemble (of class RegressionEnsemble). The compact version does not include the data for training the regression ensemble. Therefore, you cannot perform some tasks with a compact regression ensemble, such as cross validation. Use a compact regression ensemble for making predictions (regressions) of new data.

Construction

cens = compact(ens) constructs a compact decision ensemble from a full decision ensemble.

Input Arguments

ens

A regression ensemble created by fitensemble.

Properties

CategoricalPredictors

List of categorical predictors. CategoricalPredictors is a numeric vector with indices from 1 to p, where p is the number of columns of X.

CombineWeights

A string describing how the ensemble combines learner predictions.

NumTrained

Number of trained learners in the ensemble, a positive scalar.

PredictorNames

A cell array of names for the predictor variables, in the order in which they appear in X.

ResponseName

A string with the name of the response variable Y.

ResponseTransform

Function handle for transforming scores, or string representing a built-in transformation function. 'none' means no transformation; equivalently, 'none' means @(x)x.

Add or change a ResponseTransform function using dot notation:

cens.ResponseTransform = @function

Trained

The trained learners, a cell array of compact regression models.

TrainedWeights

A numeric vector of weights the ensemble assigns to its learners. The ensemble computes predicted response by aggregating weighted predictions from its learners.

Methods

lossRegression error
predictPredict response of ensemble
predictorImportanceEstimates of predictor importance
removeLearnersRemove members of compact regression ensemble

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Examples

Construct a regression ensemble for the carsmall data. Make a compact version of the ensemble, and compare its size to that of the full ensemble:

load carsmall
learner = templateTree('MinParent',20);
ens = fitensemble([Weight, Cylinders],MPG,...
    'LSBoost',100,learner,'PredictorNames',{'W','C'},...
    'categoricalpredictors',2);
cens = compact(ens);
ee = whos('ens'); % ee.bytes = size of ensemble in bytes
cee = whos('cens');
[ee.bytes cee.bytes]

ans =
      606903      587096
Was this topic helpful?