ClassificationBaggedEnsemble
Package: classreg.learning.classif
Superclasses: ClassificationEnsemble
Classification ensemble grown by resampling
Description
ClassificationBaggedEnsemble
combines a set of
trained weak learner models and data on which these learners were trained. It can
predict ensemble response for new data by aggregating predictions from its weak
learners.
Construction
Create a bagged classification ensemble object (ens
) using
fitcensemble
. Set the namevalue pair
argument 'Method'
of fitcensemble
to
'Bag'
to use bootstrap aggregation (bagging, for example, random
forest).
Properties

Bin edges for numeric predictors, specified as a cell array of p numeric vectors, where p is the number of predictors. Each vector includes the bin edges for a numeric predictor. The element in the cell array for a categorical predictor is empty because the software does not bin categorical predictors. The software bins numeric predictors only if you specify the You can reproduce the binned predictor data X = mdl.X; % Predictor data
Xbinned = zeros(size(X));
edges = mdl.BinEdges;
% Find indices of binned predictors.
idxNumeric = find(~cellfun(@isempty,edges));
if iscolumn(idxNumeric)
idxNumeric = idxNumeric';
end
for j = idxNumeric
x = X(:,j);
% Convert x to array if x is a table.
if istable(x)
x = table2array(x);
end
% Group x into bins by using the Xbinned
contains the bin indices, ranging from 1 to the number of bins, for numeric predictors.
Xbinned values are 0 for categorical predictors. If
X contains NaN s, then the corresponding
Xbinned values are NaN s.


Categorical predictor
indices, specified as a vector of positive integers. 

List of the elements in 

Character vector describing how 

Square matrix, where 

Expanded predictor names, stored as a cell array of character vectors. If the model uses encoding for categorical variables, then


Numeric array of fit information. The


Character vector describing the meaning of the 

Numeric scalar between 

Description of the crossvalidation optimization of hyperparameters,
stored as a


Cell array of character vectors with the names of weak learners in the
ensemble. The name of each learner appears only once. For example, if you
have an ensemble of 100 trees, 

Character vector describing the method that creates


Parameters used in training 

Numeric scalar containing the number of observations in the training data. 

Number of trained weak learners in 

Cell array of names for the predictor variables, in the order in which
they appear in 

Numeric vector of prior probabilities for each class. The order
of the elements of 

Character vector describing the reason 

Logical value indicating if the ensemble was trained with replacement
( 

Character vector with the name of the response variable


Function handle for transforming scores, or character vector representing
a builtin transformation function. Add or change a ens.ScoreTransform = 'function' or ens.ScoreTransform = @function 

Trained learners, a cell array of compact classification models. 

Numeric vector of trained weights for the weak learners in


Logical matrix of size


Scaled 

Matrix or table of predictor values that trained the ensemble. Each column
of 

A categorical array, cell array of character vectors, character array,
logical vector, or a numeric vector with the same number of rows as

Object Functions
compact  Compact classification ensemble 
compareHoldout  Compare accuracies of two classification models using new data 
crossval  Crossvalidate ensemble 
edge  Classification edge 
gather  Gather properties of Statistics and Machine Learning Toolbox object from GPU 
lime  Local interpretable modelagnostic explanations (LIME) 
loss  Classification error 
margin  Classification margins 
oobEdge  Outofbag classification edge 
oobLoss  Outofbag classification error 
oobMargin  Outofbag classification margins 
oobPermutedPredictorImportance  Predictor importance estimates by permutation of outofbag predictor observations for random forest of classification trees 
oobPredict  Predict outofbag response of ensemble 
partialDependence  Compute partial dependence 
plotPartialDependence  Create partial dependence plot (PDP) and individual conditional expectation (ICE) plots 
predict  Classify observations using ensemble of classification models 
predictorImportance  Estimates of predictor importance for classification ensemble of decision trees 
removeLearners  Remove members of compact classification ensemble 
resubEdge  Classification edge by resubstitution 
resubLoss  Classification error by resubstitution 
resubMargin  Classification margins by resubstitution 
resubPredict  Classify observations in ensemble of classification models 
resume  Resume training ensemble 
shapley  Shapley values 
testckfold  Compare accuracies of two classification models by repeated crossvalidation 
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Examples
Tips
For a bagged ensemble of classification trees, the Trained
property of ens
stores a cell vector of
ens.NumTrained
CompactClassificationTree
model objects. For a textual or graphical display
of tree t
in the cell vector,
enter
view(ens.Trained{t})
Extended Capabilities
Version History
Introduced in R2011aSee Also
ClassificationEnsemble
 fitcensemble
 fitctree
 view
 compareHoldout