Dear expert,
I want to know how I can do K- fold cross validation in my data set in MATLAB. I have read from MATLAB help, but I do not understand the species - is total no of observation (it means - I have total 38 data set - I have to put total no 38 or how can I define?) K is number of fold - I want to fold 5 fold so in my case it is 5 )
nother is what is meas (train,:)meas(test,:), and species (train ,:) I have 8 data set in test data set and 5 are in validation set and 25 data set are intraining how can I code this in my following coding please help me to understand this
%++++++++++++for Cross validdation+++++++++++++++++++++++++++++++++++++++++
[trainP,valP,testP] = divideind(p,trainInd,valInd,testInd);
[trainT,valT,testT] = divideind(t,trainInd,valInd,testInd);
indices = crossvalind('Kfold',species,5)
cp = classperf(species);
for i = 1:5
test = (indices == i); train = ~test;
class = classify(meas(test,:),meas(train,:),species(train,:));
classperf(cp,class,test)
end