使用 R 的 caret 進行 Machine Learning
Zach Mayer
Data Scientist at DataRobot and co-author of caret
alpha [0, 1]:從純 ridge 到純 lassolambda (0, infinity):懲罰強度# 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 值
使用 R 的 caret 進行 Machine Learning