Remove members of compact classification ensemble
idx — Learner indices
vector of positive integers
Indices of learners to remove, specified as a vector of positive integers with entries
in the range
cens.NumTrained is the number of members in
cens1 contains all members of
cens except those with indices in
Typically, you set
idx = j:cens.NumTrained for some
Remove Learners from an Ensemble
Create a compact classification ensemble. Compact it further by removing members of the ensemble.
ionosphere data set.
Train a classification ensemble for the
ionosphere data using AdaBoostM1. Specify tree stumps as the weak learners.
t = templateTree(MaxNumSplits=1); ens = fitcensemble(X,Y,Method="AdaBoostM1",Learners=t);
Create a compact classification ensemble
cens = compact(ens);
Remove the last 50 members of the ensemble.
idx = cens.NumTrained-49:cens.NumTrained; cens1 = removeLearners(cens,idx);
Removing learners reduces the memory used by the ensemble and speeds up its predictions.
To retain only one ensemble, set
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).
Introduced in R2011a