Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.


Clase: ClassificationECOC

Compact multiclass, error-correcting output codes model


CMdl = compact(Mdl)



CMdl = compact(Mdl) returns a compact, multiclass, error-correcting output codes (ECOC) model (CMdl), which is the compact version of the trained ECOC model Mdl.

CMdl does not contain the training data, whereas Mdl contains the training data in its properties Mdl.X and Mdl.Y.

Argumentos de entrada

expandir todo

Multiclass ECOC model, specified as a ClassificationECOC model returned by fitcecoc.

Output Arguments

expandir todo

Compact ECOC model, returned as a CompactClassificationECOC model.

Predict class labels using CMdl exactly as you would using Mdl. However, since CMdl does not contain training data, you cannot implement cross validation.


expandir todo

Full ECOC models (i.e., ClassificationECOC models) hold the training data. For efficiency, you might not want to predict new labels using a large classifier.

Load Fisher's iris data set.

load fisheriris
X = meas;
Y = categorical(species);
classOrder = unique(Y);

Train an ECOC model using SVM binary classifiers. It is good practice to standardize the predictors and define the class order. Specify to standardize the predictors using an SVM template.

t = templateSVM('Standardize',1);
Mdl = fitcecoc(X,Y,'Learners',t,'ClassNames',classOrder);

t is an SVM template object. The software uses default values for empty options in t during training. Mdl is a ClassificationECOC model.

Reduce the size of the trained ECOC model.

CMdl = compact(Mdl)
CMdl = 
             ResponseName: 'Y'
    CategoricalPredictors: []
               ClassNames: [setosa    versicolor    virginica]
           ScoreTransform: 'none'
           BinaryLearners: {3x1 cell}
             CodingMatrix: [3x3 double]

  Properties, Methods

CMdl is a CompactClassificationECOC model. It does not store the training data nor some of the properties that Mdl stores.

Display how much memory each classifier uses.

  Name      Size            Bytes  Class                                                  Attributes

  CMdl      1x1             12956  classreg.learning.classif.CompactClassificationECOC              
  Mdl       1x1             25784  ClassificationECOC                                               

The full ECOC model (Mdl) is approximately double the size of the compact ECOC model (CMdl).

You can remove Mdl from the MATLAB® Workspace, and pass CMdl and new predictor values to predict to efficiently label new observations.