From: sara on
Hi,
In the Help example, the crossvalind.m is used once outside the for loop. What exactly does Indices contain, the result for one partitioning or the average of K iterations?
Do I need to call crossvalind inside a for loop in order to esure that "This process is repeated K times, leaving one different fold for evaluation each time"?
From: Tom Lane on
> In the Help example, the crossvalind.m is used once outside the for loop.
> What exactly does Indices contain, the result for one partitioning or the
> average of K iterations?

Just take a look:

load fisheriris
indices = crossvalind('Kfold',species,10);

You'll see that it's a numeric vector containing the fold number assigned to
each row.

> Do I need to call crossvalind inside a for loop in order to esure that
> "This process is repeated K times, leaving one different fold for
> evaluation each time"?

By leaving it outside the loop you insure that the assignment of rows to
folds doesn't change. So then when you leave out one fold at a time in the
loop, you're leaving out each observation exactly once.

-- Tom