Reduce the size of a full ECOC model by removing the training data. Full ECOC models (ClassificationECOC
models) hold the training data. To improve efficiency, use a smaller classifier.
Load Fisher's iris data set. Specify the predictor dataX
, the response dataY
, and the order of the classes inY
.
Train an ECOC model using SVM binary classifiers. Standardize the predictor data using an SVM templatet
, and specify the order of the classes. During training, the software uses default values for empty options int
.
Mdl
is aClassificationECOC
model.
Reduce the size of the ECOC model.
CompactMdl = CompactClassificationECOC ResponseName: 'Y' CategoricalPredictors: [] ClassNames: [setosa versicolor virginica] ScoreTransform: 'none' BinaryLearners: {3x1 cell} CodingMatrix: [3x3 double] Properties, Methods
CompactMdl
is aCompactClassificationECOC
model.CompactMdl
does not store all of the properties thatMdl
stores. In particular, it does not store the training data.
Display the amount of memory each classifier uses.
Name Size Bytes Class Attributes CompactMdl 1x1 15116 classreg.learning.classif.CompactClassificationECOC Mdl 1x1 28357 ClassificationECOC
The full ECOC model (Mdl
) is approximately double the size of the compact ECOC model (CompactMdl
).
To label new observations efficiently, you can removeMdl
from the MATLAB® Workspace, and then passCompactMdl
and new predictor values topredict
.