これが私がすることです:
// Initialize result matrix
Results = zeros(size(Datas,1),2);
// Validate classifier settings with leave-one-out procedure
for k=1:size(Datas,1)
// Extract sample
ind = Datas(k,:);
// Copy the database
Datas_mod = Datas;
// Copy the classes vector
Classes_mod = Classes;
// Keep the sample real class
Results(k,2) = Classes(k);
// Remove sample from database
Datas_mod(k,:) = [];
// Remove sample from class vector
Classes_mod(k) = [];
// Execute the classification algorithm
[Individu,MxD(k)] = knn(ind(1,1:size(ind,2)),Datas_mod,Classes_mod,5,700);
// Keep the class found by the classifier for the current sample
Results(k,1) = Individu(1,size(Individu,2));
end
// Confusion matrix
CM = nan_confusionmat(Results(:,1),Results(:,2)) // Scilab function, find your own
knn を、使用している分類子に置き換えるだけです。この助けを願っています。