Machine Learning with caret in R
Zach Mayer
Data Scientist at DataRobot and co-author of caret
alpha [0, 1]
: pure ridge to pure lassolambda (0, infinity)
: size of the penalty# Load data
overfit <- read.csv("overfit.csv")
# Make a custom trainControl
myControl <- trainControl(
method = "cv",
number = 10,
summaryFunction = twoClassSummary,
classProbs = TRUE, # <- Super important!
verboseIter = TRUE
)
# Fit a model
set.seed(42)
model <- train(
y ~ .,
overfit,
method = "glmnet",
trControl = myControl
)
# Plot results
plot(model)
alpha
lambda
Machine Learning with caret in R