Cross-validation using linear discriminant analysis
显示 更早的评论
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Discriminant Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!