0
$\begingroup$

This question already has an answer here:

I think I barely understand how k-fold CV is working and I have a question about it.

For example, when I run 5-fold cross-validation (in SAS), I use 5 subsets of the training data, and end up with 5 different models. But I have only one output for it. I understand the error rate is the average of those 5-folds' errors. But my model creating with which data set? When effective variables are being determinated, will SAS average the coefficients? If it's not like this, which fold will be chosen for creating my model?

(Sorry, English is not my native language)

$\endgroup$

marked as duplicate by Peter Flom Feb 27 '18 at 12:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
$\begingroup$

You usually use the 5 folds to have a performance estimate.

Once you have that you train your model on your entire dataset.

The best is actually to split you dataset into a say 80% and 20%. You do the cross validation on the 80% of the dataset, so divide into 5 equal parts, assess the performance with CV and then train over the whole 80% and test again the 20% thta oyu kept on the side.

This is cross validation and then validation.

$\endgroup$
  • 1
    $\begingroup$ I get how 5 fold cross validation works to recursively partition the dataset into 5 train and 1 test set 5 times to get an estimate of out of sample performance. What i'm not sure is how the 5 models are then aggregated into one single model that can be used to predict against a new dataset. just average to coefficients of each model? $\endgroup$ – slnktlgn Feb 27 '18 at 12:14
  • $\begingroup$ You retrain you model on the whole dataset $\endgroup$ – Charlotte Feb 27 '18 at 12:27

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