在 R 中使用 caret 的机器学习
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 的机器学习