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

    %% Determine the Resubstitution Loss 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 data.
SVMModel = fitcsvm(X,Y,'ClassNames',{'b','g'},'Standardize',true);
%%
% |SVMModel| is a trained |ClassificationSVM| classifier. The negative
% class is |'b'| and the positive class is |'g'|.
%%
% Estimate the resubstitution loss (i.e., the in-sample classification
% error).
L = resubLoss(SVMModel)
%%
% The SVM classifier misclassifies 5.7% of the training sample radar returns.