lm6control <- trainControl(method = "repeatedcv",
number = 2,
repeats = 3)
lm6grid <- expand.grid(alpha = seq(0, 1, 0.1),
lambda = c(0, 0.00001, 0.0001, 0.001, 0.01, 0.1, 0.2, 0.5, 1))
lm6 <- train(form = FACE ~ .,
data = termlife.insured.train,
method = "glmnet",
trControl = lm6control,
tuneGrid = lm6grid)
我上面的代码编写方式有什么问题吗?
Alpha会对结果产生影响。
但是,lambda却无济于事,因为随着它变大,它应该越来越缩小系数。