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

    %% Compare Accuracies of Two Different Classification Models
% Conduct a statistical test comparing the misclassification rates of the
% two models using a 5-by-2 paired _F_ test.
%%
% Load Fisher's iris data set.

% Copyright 2015 The MathWorks, Inc.

load fisheriris;
%%
% Create a naive Bayes template and a classification tree template using
% default options.
C1 = templateNaiveBayes;
C2 = templateTree;
%%
% |C1| and |C2| are template objects corresponding to the naive Bayes
% and classification tree algorithms, respectively. 
%%
% Test whether the two models have equal predictive accuracies.  Use the
% same predictor data for each model. |testckfold| conducts a 5-by-2,
% two-sided, paired _F_ test by default.
rng(1); % For reproducibility
h = testckfold(C1,C2,meas,meas,species)
%%
% |h = 0| indicates to not reject the null hypothesis that the two models
% have equal predictive accuracies.