# In caret what is the real difference between cv and repeatedcv?

This is similar to question Caret re-sampling methods, although that really never answered this part of the question in an agreed upon way.

caret's train function offers cv and repeatedcv. What is the difference in say doing:

MyTrainControl=trainControl(
method = "cv",
number=5,
repeats=5
)


vs

MyTrainControl=trainControl(
method = "repeatedcv",
number=5,
repeats=5
)


I understand cv breaks the set into k-folds (parameter number), and then starts over and runs it parameters repeats number of times.

The only thing I could think of is that maybe regular cv with repeats uses the same exact indexes for the folds each time? essentially running the cv on the same exact folds each time, vs perhaps repeatedcv selects new folds each times?

Can someone clarify?

-

According to the caret manual, page 22, the parameter repeats only applies when the method is set to repeatedcv, so no repetition is performed when the method is set to cv. So the difference between both methods is indeed that repeatedcv repeats and cv does not.

Aside: Repeating a crossvalidation with exactly the same splitting will yield exactly the same result for every repetition (assuming that the model is trained in a deterministic manner), which is not only inefficient, but also dangerous when it comes to comparing the validation results for different model algorithms in a statistical manner. So be aware of this if you ever have to program a validation yourself.

-
Steffen, thank you for your answer. – Brian Feeny Nov 28 '12 at 18:25
@BrianFeeny glad to help. If the answer was satisfactory, please consider to click the check mark below the vote up / down button. See the FAQ on asking questions for details :) – steffen Nov 29 '12 at 6:40

here is the actual code behind these parameters

https://github.com/topepo/caret/blob/a90ac016f8c8776562d53aa95204ca3624caae67/pkg/caret/R/selectByFilter.R#L55

and the createFolds & createMultiFolds functions actually take care of 'cv' and 'repeatedcv'

-
take a look at their functions....github.com/tonglu/caret/blob/master/pkg/caret/R/… – user3466398 Sep 10 '14 at 23:19
Could you please give more context in your answer? Links are good, but we try to avoid answers that won't stand on their own -- links can disappear. – Glen_b Sep 11 '14 at 0:54