Cross-validation using linear discriminant analysis
Afficher commentaires plus anciens
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.
Réponses (0)
Catégories
En savoir plus sur Discriminant Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!