필터 지우기
필터 지우기

Using Classification and subsets

조회 수: 1 (최근 30일)
Dan Marko
Dan Marko 2016년 1월 4일
편집: Image Analyst 2016년 1월 5일
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!

답변 (1개)

Sean de Wolski
Sean de Wolski 2016년 1월 4일
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!

Translated by