Create compact regression ensemble
cens = compact(ens)
creates a compact version of
cens = compact(
ens. You can predict regressions
cens exactly as you can using
cens does not contain training data, you cannot
perform some actions, such as cross validation.
A regression ensemble created with
A compact regression ensemble.
View Size of Compact Regression Ensemble
Compare the size of a regression ensemble for the
carsmall data to the size of the compact version of the ensemble.
carsmall data set and select acceleration, number of cylinders, displacement, horsepower, and vehicle weight as predictors.
load carsmall X = [Acceleration Cylinders Displacement Horsepower Weight];
Train an ensemble of regression trees.
ens = fitrensemble(X,MPG);
Create a compact version of
ens and compare ensemble sizes.
cens = compact(ens); b = whos('ens'); c = whos('cens'); [b.bytes c.bytes] % b.bytes = size of ens and c.bytes = size of cens
ans = 1×2 483838 451479
The compact ensemble uses less memory.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).