I think I must be missing some fundamental part of the logic of cross-validation, or machine learning in general.
caret package in R, I ran a repeated k-fold cross-validation and compared the resulting coefficients to an identical model fit using
trainControl <- trainControl(method = "repeatedcv", number = 10, repeats = 30 fit <- train(Petal.Length ~ ., data = iris, trControl = trainControl, method = "lm") fit$FinalModel fit.lm <- lm(Petal.Length ~ ., data = iris) fit.lm
They are identical, all the way out the the 4th decimal place. Why? I thought cross validation uses resampling to calculate coefficients, get the average, and these will perform better on future data than coefficients from a standard linear model. The point is that the latter coefficients are usually overly optimistic. Am I misunderstanding this process, or did I just use the incorrect code, miss a step or something?
Thank you in advance for your time.