0
$\begingroup$

I have some questions regarding $k$-fold CV. So far, I understand how $k$-fold CV works as well as what type of results we can obtain at the end of the $k$-fold iterations. However, there is an interesting question that follows when we repeatedly perform $k$-fold CV, especially linked to how the samples are split. To help visualize the problem, let's assume that I'm using a dataset of $M$ distinct samples where $M = kI, I \in \mathbb{N}$. The feature length, or the number of predictors are not important here.

The principle of $k$-fold CV, as I understand it, is to partition the dataset into $k$ (roughly) equal-sized subsets, compose a test set using one of the available $k$ subsets and utilize the remaining $k-1$ subsets as a training set. The predictive model is obtained by training a learning machine using the training set and test this tuned predictive model on the test set in order to obtain some measure of generalization performance.

What is not mentioned, however, is that the $k$ subsets are non-overlapping. Now, assume that I repeatedly perform $k$-fold CV for $N$ runs. If I take the same $k$ subsets everytime, then I expect to obtain exactly the same result for each repeated run. However, since the samples are distinct (i.e. no two samples are equal), it is possible to group them into $k$ different non-overlapping subsets for each run.

To illustrate, let's assume $M = 10$ and $k = 5$ ($5$-fold CV). Consider a binary-valued vector $\mathbf{v}_{test}$ that basically selects the samples to be used as the test set. The most trivial ones would be

$$ \mathbf{v}_{test1} = [1 1 0 0 0 0 0 0 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test2} = [0 0 1 1 0 0 0 0 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test3} = [0 0 0 0 1 1 0 0 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test4} = [0 0 0 0 0 0 1 1 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test5} = [0 0 0 0 0 0 0 0 1 1]^{\mathrm{T}} $$

Suppose that we use the trivial way of splitting, as shown above, for run $n=1$. We get a performance figure $F_{1}$. Now we consider the following vectors

$$ \mathbf{v}_{test1} = [0 1 0 1 0 0 0 0 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test2} = [0 0 1 0 1 0 0 0 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test3} = [0 0 0 0 0 1 0 1 0 0]^{\mathrm{T}}\\ \mathbf{v}_{test4} = [0 0 0 0 0 0 1 0 1 0]^{\mathrm{T}}\\ \mathbf{v}_{test5} = [1 0 0 0 0 0 0 0 0 1]^{\mathrm{T}} $$

Performing the same maneuvers, we obtain $F_{2}$ for the next run, which in theory should be different from $F_{1}$.

Now, for each run, it is clear that no one sample belongs to two or more subsets. But when comparing between runs, we see that the subsets are clearly overlapping (ex. $\mathbf{v}_{test1}$ in run $n=1$ shares one similar sample with $\mathbf{v}_{test5}$ in run $n=2$)

So my questions are:

$\mathbf{Q1}$: Are the two figures $F_{1}$ and $F_{2}$ comparable despite this overlap?

$\mathbf{Q2}$: Can a summary statistics be computed on the ensemble of $F_{n}$'s (in particular, the mean)?

$\mathbf{Q3}$: Would there be a problem with the summary statistics if we authorized an insignificant number of sample overlaps (say less than $10\%$ of the samples are similar in the test sets of runs $n$ and $n+1$)?

Thanks,

$\endgroup$
3
  • $\begingroup$ Can you please clarify why you think there should be a problem? For example any sample point in a simple bootstrap has a $1-(1-\frac{1}{N})^{N}$ chance of being picked and bootstraps works wonderfully. Techniques like out-of-bootstrap and repeated $k$-fold cross validation are commonly used. Sampling with replacement is generally fine given that we do not repeatedly sample a substantial portion of our true population (i.e. we have good mixing). $\endgroup$
    – usεr11852
    Commented Jul 25, 2018 at 22:34
  • $\begingroup$ For one, if the samples are indeed substantially similar from run to run (what I would call in this case significant overlaps) then I would expect results to have great similarity. $\endgroup$
    – KaiserHaz
    Commented Jul 26, 2018 at 3:50
  • $\begingroup$ I'm not questioning the validity of bootstrap, but rather I would like to know if at the end the figures from different runs are comparable and ultimately averageable. Does it make sense to even average them? $\endgroup$
    – KaiserHaz
    Commented Jul 26, 2018 at 3:52

1 Answer 1

1
$\begingroup$

Ideally, i.e. if your training is stable, predictions for the same case of all runs should be the same, and in consequence so should be the performance measures.

So yes, you can sensibly calculate aggregates, but you need to think about this similarity. Mean performance is OK, however, uncertainty/variance estimates are not that easy (and number of runs / surrogate models alone is not an appropriate denominator/estimate for degrees of freedom).

Any deviation you observe between the runs can only come from model instability, i.e. differences in the (surrogate) models: if you compare the 2 surrogate models tested with, say, case 1 in your example, the only difference (if your training is deterministic) is due to exchanging case 10 and 2 in the training sets.

Have a look at our paper: Beleites, C. & Salzer, R.: Assessing and improving the stability of chemometric models in small sample size situations, Anal Bioanal Chem, 390, 1261-1271 (2008). DOI: 10.1007/s00216-007-1818-6
(Please disregard our attempt at estimating an effective sample size - I'm now thinking it doesn't work that way.)

$\endgroup$
4
  • $\begingroup$ What do you mean by stable in your first paragraph? $\endgroup$
    – KaiserHaz
    Commented Dec 17, 2018 at 12:30
  • $\begingroup$ Stable means that if you train with a slightly different training set (here: exchanging a few training cases agaist a few other training cases), you nevertheless arrive at the same (or a very similar) model, i.e. the estimated parameters of the model do not or only very slightly vary. $\endgroup$
    – cbeleites
    Commented Dec 17, 2018 at 12:47
  • $\begingroup$ Then I imagine that stability would also be affected or related to the sample size we have available for training, am I correct? $\endgroup$
    – KaiserHaz
    Commented Dec 24, 2018 at 14:00
  • $\begingroup$ @KaiserHaz: Yes. $\endgroup$
    – cbeleites
    Commented Dec 24, 2018 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.