Reputation: 67
I am currently trying to fit an Elastic Net Regression Model on a largish dataset (28 variables, 1675 data points). I'm new to working with caret, but I decided to try some alpha and lambda tuning on my dataset to create an Elastic Net model; however, I end up with a warning and an error, I believe this is due to my model not converging properly, but I don't know why that would be.
trc = trainControl(method = "repeatedcv",
number = 5,
repeats = 10,
search = "random",
verboseIter = TRUE)
elastic = train([to be predicted] ~ .,
data = [log transformed data],
method = "glmnet",
tuneLength = 10,
trControl = trc)
Output(excluding the Fold[x].Rep[y] outputs):
Aggregating results
Selecting tuning parameters
Fitting alpha = 0.432, lambda = 2.78 on full training set
Error in `[.data.frame`(data, , all.vars(Terms), drop = FALSE) :
undefined columns selected
I can give someone the data in a csv file but I'm not sure if I can upload that to stack overflow
I am expecting the output of an Elastic Regression Model, but instead it ran through all of the cross validation and selected a fitted alpha and lambda value from that cross validation. But then I receiveed an error that looks like the alpha and lambda didn't converge.
FIX: When I used [to be predicted] I used data$[to be predicted] in my case price, so data$price ~ ., data = data, ... If you change data$price to just price then is works perfectly fine.
Upvotes: 1
Views: 127