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 cross-validation 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
|
|
Rows of the original training data stored in the model, specified as a
logical vector. This property is empty if all rows are stored in
|
|
Function handle for transforming scores, or character vector representing
a built-in 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 | Reduce size of classification ensemble model |
compareHoldout | Compare accuracies of two classification models using new data |
crossval | Cross-validate classification ensemble model |
edge | Classification edge for classification ensemble model |
gather | Gather properties of Statistics and Machine Learning Toolbox object from GPU |
lime | Local interpretable model-agnostic explanations (LIME) |
loss | Classification loss for classification ensemble model |
margin | Classification margins for classification ensemble model |
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 | Resubstitution classification edge for classification ensemble model |
resubLoss | Resubstitution classification loss for classification ensemble model |
resubMargin | Resubstitution classification margins for classification ensemble model |
resubPredict | Classify observations in classification ensemble model |
resume | Resume training of classification ensemble model |
shapley | Shapley values |
testckfold | Compare accuracies of two classification models by repeated cross-validation |
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
-by-1
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