How do I sequentially partition the folds in cross validation?

조회 수: 1 (최근 30일)
Petter Stefansson
Petter Stefansson 2016년 4월 12일
답변: Jo 2016년 11월 4일
I’m working on a partial least squares regression problem where I want to set up cross validation with a cvpartition object. However, I can’t seem to figure out how to make it partition the folds so that the observations are picked consecutively, which I need them to be.
If I write:
c = cvpartition(length(Y),'KFold',10)
it just partitions the folds randomly if I understand the documentation correct. In fact, every option I’ve read about in the documentation seems to be based on random partitioning. Surely there has to be an option for consecutively partitioning the observations?
One idea I had was to first create a random cvpartition object and then manipulate it by manually forcing the object to use indices that I assign in each fold like this:
c.training(i) = TrainIndex(i,:)'
but matlab doesn’t seem to give me permission to do that.
Does anyone know how to do this? If my data for example goes from 1 to 100 I want my folds to consist of 1:10, 11:20, 21:30 etc. or something like that.
Thanks.

답변 (1개)

Jo
Jo 2016년 11월 4일
Hi Petter,
Did you find a way to do what you wanted ?
I need to choose my own subsets for the cross-validation and not random ones for optimizing SVM parameters.
And I cannot find a solution. Please tell me if you have one...
Thanks

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by