Machine Learning with caret in R
Zach Mayer
Data Scientist at DataRobot and co-author of caret
# Make a custom tuning grid
myGrid <- expand.grid(
alpha = 0:1,
lambda = seq(0.0001, 0.1, length = 10)
)
# Fit a model
set.seed(42)
model <- train(
y ~ .,
overfit,
method = "glmnet",
tuneGrid = myGrid,
trControl = myControl
)
# Plot results
plot(model)
plot(model$finalModel)
Machine Learning with caret in R