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

    %% Estimate the Resubstitution Edge of SVM Classifiers
%%
% Load the |ionosphere| data set.

% Copyright 2015 The MathWorks, Inc.

load ionosphere
%%
% Train an SVM classifier. It is good practice to standardize the
% predictors and define the class order.
SVMModel = fitcsvm(X,Y,'Standardize',true,'ClassNames',{'b','g'});
%%
% |SVMModel| is a trained |ClassificationSVM| classifier. |'b'| is the
% negative class and |'g'| is the positive class.
%%
% Estimate the resubstitution edge. 
e = resubEdge(SVMModel) 
%%
% The mean of the training sample margins is |5.0999|.