Remove members of compact classification ensemble
cens1 = removeLearners(cens,idx)
Compact classification ensemble, constructed with
Vector of positive integers with entries from
Typically, you set
Compact classification ensemble, identical to
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);
cens1 equal to
retain just one ensemble.
Removing learners reduces the memory used by the ensemble and speeds up its predictions.