ClassificationEnsemble
Package: classreg.learning.classif
Superclasses: CompactClassificationEnsemble
Ensemble classifier
Description
ClassificationEnsemble
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. It
stores data used for training, can compute resubstitution predictions, and can resume
training if desired.
Construction
Create a classification ensemble object (ens
) using fitcensemble
.
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 

Description of the crossvalidation optimization of hyperparameters,
stored as a


Cell array of character vectors with names of weak learners in the
ensemble. The name of each learner appears just 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 

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 

A cell vector of trained classification models.


Numeric vector of trained weights for the weak learners in


Logical matrix of size If the ensemble is not of type 

Scaled 

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

Numeric vector, categorical vector, logical vector, character array, or
cell array of character vectors. Each row of 
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 
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 
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 an ensemble of classification trees, the Trained
property
of ens
stores an ens.NumTrained
by1
cell vector of compact classification models. For a textual or graphical
display of tree t
in the cell vector, enter:
view(ens.Trained{
for ensembles aggregated using LogitBoost or GentleBoost.t
}.CompactRegressionLearner)view(ens.Trained{
for all other aggregation methods.t
})
Extended Capabilities
Version History
Introduced in R2011aSee Also
ClassificationTree
 fitcensemble
 CompactClassificationEnsemble
 view
 compareHoldout