Cross-validation using linear discriminant analysis
Show older comments
The following code performs 10-fold cross-validation using linear discriminant analysis:
load fisheriris
indices = crossvalind('Kfold',species,10);
cp = classperf(species); % initializes the CP object
for i = 1:10
test = (indices == i); train = ~test;
class = classify(meas(test),meas(train),species(train));
% updates the CP object with the current classification results
classperf(cp,class,test)
end
cp.CorrectRate
How can this be modified to use fitcdiscr instead of classify on line 7? When I try, I get an error (Wrong number of arguments). I do not know what arguments are needed or not.
Answers (0)
Categories
Find more on Discriminant Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!