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.