www.gusucode.com > stats 源码程序 matlab案例代码 > stats/LoadCompactSVMModelFromStructureArrayExample.m

    %% Load Compact SVM Model from Structure Array
%%
% Load the |ionosphere| data set.
load ionosphere
%%
% Train an SVM classification model using the entire data set.
% Specify to standardize the data.
Mdl = fitcsvm(X,Y,'Standardize',true)
%%
% |Mdl| is a |ClassificationSVM| model.
%%
% Save the SVM classification model to the file |'SVMIonosphere.mat'|.
saveCompactModel(Mdl,'SVMIonosphere');
%%
% |'SVMIonosphere.mat'| appears in your present working directory.
% |saveCompactModel| reduces the memory footprint of the model by removing
% properties that are not needed for prediction, for example, the training
% data. Then, |saveCompactModel| saves a structure array that characterizes
% |Mdl| in |'SVMIonosphere.mat'|.
%%
% Load the structure array in |'SVMIonosphere.mat'| to the Workspace.
CompactMdl = loadCompactModel('SVMIonosphere')
%%
% |CompactMdl| is a |CompactClassificationSVM| model equipped to make
% predictions.