Documentation Center

  • Trial Software
  • Product Updates

CompactClassificationEnsemble class

Compact classification ensemble class

Description

Compact version of a classification ensemble (of class ClassificationEnsemble). The compact version does not include the data for training the classification ensemble. Therefore, you cannot perform some tasks with a compact classification ensemble, such as cross validation. Use a compact classification ensemble for making predictions (classifications) of new data.

Construction

cens = compact(ens) constructs a compact decision ensemble from a full decision ensemble.

Input Arguments

ens

A classification ensemble created by fitensemble.

Properties

CategoricalPredictors

List of categorical predictors. CategoricalPredictors is a numeric vector with indices from 1 to p, where p is the number of columns of X.

ClassNames

List of the elements in Y with duplicates removed. ClassNames can be a numeric vector, vector of categorical variables, logical vector, character array, or cell array of strings. ClassNames has the same data type as the data in the argument Y.

CombineWeights

String describing how ens combines weak learner weights, either 'WeightedSum' or 'WeightedAverage'.

Cost

Square matrix where Cost(i,j) is the cost of classifying a point into class j if its true class is i.

NumTrained

Number of trained weak learners in cens, a scalar.

PredictorNames

A cell array of names for the predictor variables, in the order in which they appear in X.

Prior

Prior probabilities for each class. Prior is a numeric vector whose entries relate to the corresponding ClassNames property.

ResponseName

String with the name of the response variable Y.

ScoreTransform

Function handle for transforming scores, or string representing a built-in transformation function. 'none' means no transformation; equivalently, 'none' means @(x)x. For a list of built-in transformation functions and the syntax of custom transformation functions, see fitctree.

Add or change a ScoreTransform function using dot notation:

cens.ScoreTransform = 'function'

or

cens.ScoreTransform = @function

Trained

Trained learners, a cell array of compact classification models.

TrainedWeights

Numeric vector of trained weights for the weak learners in ens. TrainedWeights has T elements, where T is the number of weak learners in learners.

UsePredForLearner

Logical matrix of size P-by-NumTrained, where P is the number of predictors (columns) in the training data X. UsePredForLearner(i,j) is true when learner j uses predictor i, and is false otherwise. For each learner, the predictors have the same order as the columns in the training data X.

If the ensemble is not of type Subspace, all entries in UsePredForLearner are true.

Methods

edgeClassification edge
lossClassification error
marginClassification margins
predictPredict classification
predictorImportanceEstimates of predictor importance
removeLearnersRemove members of compact classification ensemble

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Examples

Create a compact classification ensemble for the ionosphere data:

load ionosphere
ens = fitensemble(X,Y,'AdaBoostM1',100,'Tree');
cens = compact(ens)
cens = 

  classreg.learning.classif.CompactClassificationEnsemble
    PredictorNames: {1x34 cell}
      ResponseName: 'Y'
        ClassNames: {'b'  'g'}
    ScoreTransform: 'none'
        NumTrained: 100


  Properties, Methods

See Also

| | | |

Was this topic helpful?