Create compact regression ensemble
cens = compact(ens)
cens = compact(ens) creates a compact version of ens. You can predict regressions using cens exactly as you can using ens. However, since cens does not contain training data, you cannot perform some actions, such as cross validation.
A regression ensemble created with fitensemble.
A compact regression ensemble. cens is of class CompactRegressionEnsemble.
Compare the size of a regression ensemble for the carsmall data to the compact version of the ensemble:
load carsmall X = [Acceleration Cylinders Displacement Horsepower Weight]; ens = fitensemble(X,MPG,'LSBoost',100,'Tree'); cens = compact(ens); b = whos('ens'); % b.bytes = size of ens c = whos('cens'); % c.bytes = size of cens [b.bytes c.bytes] % shows ctree uses less memory ans = 311789 287368