If we use cross validation in trainControl function, still do we need to perform the prediction on test set or training data in train function is sufficient?

I split the data in training and testing, used k fold cross validation in trainControl and prediction in train function. Is it OK?


1 Answer 1


You'll always use your unseen test data to evaluate your model in order to be fair and reduce bias in your results.

  • $\begingroup$ OK but when we use k fold cv, the test data is always separated from the train data. So still we need to perform the prediction on test data such as, rmse(ts$output variable, predict) $\endgroup$
    – AAA
    Jan 21, 2020 at 11:08
  • $\begingroup$ You have two splits: train and test. In the train, when you perform some kind of cross-validation, you split your training set into training and validation sets. But, test is outside of these splits. You have train and validation sets throughout your hyper-parameter optimization. Then, after finalizing the model, you'll use the whole training set and predict on the test set. $\endgroup$
    – gunes
    Jan 21, 2020 at 12:47
  • $\begingroup$ Thanks a lot gunes $\endgroup$
    – AAA
    Jan 22, 2020 at 9:26

Your Answer

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

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