www.gusucode.com > stats 源码程序 matlab案例代码 > stats/EstimateTheResubstitutionEdgeOfNaiveBayesClassifiersExample.m
%% Estimate the Resubstitution Edge of Naive Bayes Classifiers %% % Load Fisher's iris data set. % Copyright 2015 The MathWorks, Inc. load fisheriris X = meas; % Predictors Y = species; % Response rng(1); %% % Train a naive Bayes classifier. It is good practice to specify the class % order. Assume that each predictor is conditionally, normally distributed % given its label. Mdl = fitcnb(X,Y,'ClassNames',{'setosa','versicolor','virginica'}); %% % |Mdl| is a trained |ClassificationNaiveBayes| classifier. %% % Estimate the resubstitution edge. e = resubEdge(Mdl) %% % The mean of the training sample margins is approximately |0.9|, which % indicates that the classifier classifies in-sample observations with high % confidence.