Reduce the size of a full SVM classifier by removing the training data. Full SVM classifiers (that is, ClassificationSVM
classifiers) hold the training data. To improve efficiency, use a smaller classifier.
Load the ionosphere
data set.
Train an SVM classifier. Standardize the predictor data and specify the order of the classes.
SVMModel =
ClassificationSVM
ResponseName: 'Y'
CategoricalPredictors: []
ClassNames: {'b' 'g'}
ScoreTransform: 'none'
NumObservations: 351
Alpha: [90x1 double]
Bias: -0.1343
KernelParameters: [1x1 struct]
Mu: [1x34 double]
Sigma: [1x34 double]
BoxConstraints: [351x1 double]
ConvergenceInfo: [1x1 struct]
IsSupportVector: [351x1 logical]
Solver: 'SMO'
Properties, Methods
SVMModel
is a ClassificationSVM
classifier.
Reduce the size of the SVM classifier.
CompactSVMModel =
CompactClassificationSVM
ResponseName: 'Y'
CategoricalPredictors: []
ClassNames: {'b' 'g'}
ScoreTransform: 'none'
Alpha: [90x1 double]
Bias: -0.1343
KernelParameters: [1x1 struct]
Mu: [1x34 double]
Sigma: [1x34 double]
SupportVectors: [90x34 double]
SupportVectorLabels: [90x1 double]
Properties, Methods
CompactSVMModel
is a CompactClassificationSVM
classifier.
Display the amount of memory each classifier uses.
Name Size Bytes Class Attributes
CompactSVMModel 1x1 31058 classreg.learning.classif.CompactClassificationSVM
SVMModel 1x1 141148 ClassificationSVM
The full SVM classifier (SVMModel
) is more than four times larger than the compact SVM classifier (CompactSVMModel
).
To label new observations efficiently, you can remove SVMModel
from the MATLAB® Workspace, and then pass CompactSVMModel
and new predictor values to predict
.
To further reduce the size of your compact SVM classifier, use the discardSupportVectors
function to discard support vectors.