0
$\begingroup$

My question on k-fold is not about evaluations of the model, but rather the coefficients that are returned by it.

In the R code below, I am performing 3-fold cross validation, which is to say the model is trained and tested three times. The keyword I am looking at is "trained".

My question is... how do the coefficient values get set? Is it an average of the three folds or another method?

library(caret)

formula <- nos_yn ~ phone_conf_yn + nos10iact

train_control <- trainControl(method = "cv", number = 3, summaryFunction = twoClassSummary, classProbs = T)

model <- train(formula, data=training, trControl=train_control, method="glm", metric = "ROC", family=binomial(link="logit"))

data.frame(summary(model)$coefficients[,1])

                                summary.model..coefficients...1.
(Intercept)                                           -2.1853334
`phone_conf_ynBad Phone Number`                        0.7364689
phone_conf_ynConfirmed                                -1.2032336
`phone_conf_ynNull/Other`                             -0.6636189
nos10iact                                              0.3016733
$\endgroup$
  • 2
    $\begingroup$ I read the link provided by Jan. Thank you, Jan. I think the answer to my question is the coefficients above are from training on all the data and not the folds. Am I correct? $\endgroup$ – Matthew Jun 14 '18 at 13:58
  • $\begingroup$ yes - train on the whole data set. $\endgroup$ – cbeleites supports Monica Jun 15 '18 at 12:08