1
$\begingroup$

As I understand when setting trainControl(method="cv") in the caret package, my training set is is split into K folds for cross validation. How is this splitting done? I assume it is randomized and stratified?

But the train set has been "upsampled" and if the split is randomized there will be a data leak over the train and test folds. (which lead to a overfit of course.) So, how can I avoid that the split is randomized and stratified? I want the folds to be made of consecutive samples. Can that be achieved?

$\endgroup$
  • 1
    $\begingroup$ Why not perform the train test split first and then CV over the train set? There will be no data leakage. $\endgroup$ – Sada93 Aug 3 '17 at 16:36
  • $\begingroup$ @Sada93 First split the cv folds and then "upsample", you mean? Yes, that would be the smartest thing to do, however this was not coded by me personally. $\endgroup$ – Øystein Schønning-Johansen Aug 3 '17 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.