Machine Learning with caret in R
Zach Mayer
Data Scientist at DataRobot and co-author of caret
# Set seed for reproducibility
set.seed(42)
# Fit linear regression model
model <- train(
mpg ~ hp, mtcars,
method = "lm",
trControl = trainControl(
method = "cv",
number = 10,
verboseIter = TRUE
)
)
+ Fold01: intercept=TRUE
- Fold01: intercept=TRUE
...
- Fold10: intercept=TRUE
Aggregating results
Fitting final model on full training set
Machine Learning with caret in R