Clear Filters
Clear Filters

Using Classification and subsets

1 view (last 30 days)
Dan Marko
Dan Marko on 4 Jan 2016
Edited: Image Analyst on 5 Jan 2016
I'm trying to use the Discriminant Analysis to classify 4 groups from a pool of data, and I've encountered an issue I'm unable to solve.
I've used the following code sample from the 'Classification' page:
lda = fitcdiscr(My_Data,species);
ldaClass = resubPredict(lda);
ldaResubErr = resubLoss(lda); %resubstitution error
cp = cvpartition(species,'KFold',10);
cvlda = crossval(lda,'CVPartition',cp);
ldaCVErr = kfoldLoss(cvlda);
Now, my question is this: is it possible to know what part of the data is being used as the training set, and what part is being used for the classification? To clarify, after I use 'cvpartition' for say, 10 subsets, I can 10x2 groups where for each subset I have a 'training set' and a 'classification set', but I can't seem to find any way to determine which is which.
I hope my question is clear enough. Thank you for your help and time!

Answers (1)

Sean de Wolski
Sean de Wolski on 4 Jan 2016
Look at the training and test methods of the cvpartition.
cv = cvpartition(100,'KFold',3);
train2 = training(cv,2) % 2nd fold training set is true

Community Treasure Hunt

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

Start Hunting!