How to create matrix for leave-one-out-cross validation?

I have dataset that turned into 3500x400 matrix. I want to apply leave one out cross validation. But i cant seem to generate the right train-matrix. Please help.
mix=randperm(3500);
for i=1:10% divide into 10sets of 350 rows each
test = mix(1+350*(i-1):350*i);
train = mix([1+350*(i-2):350*(i+1)-1 350*(i+1):3500]);
train_labels = Labels(train);
test_labels = Labels(test);
%train model
nb(i) = fitcnb(traina, train_labels,'DistributionNames','mn');
y(i) = predict(nb,test);
%Check if prediction was correct
accuracy(i) = test_labels/350;
end

Antworten (0)

Gefragt:

am 5 Dez. 2015

Bearbeitet:

am 5 Dez. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by