I'm using "glmnet" package in R to learn different elastic net regressions. As you know, elastic net should perform at least as good as LASSO regression. But it's not the case for me and LASSO perform better than elastic net. I thought that, maybe the stepsize which I choose for the alpha is too big. Would someone recommend me a good step size for the alpha parameter?

Here is the part of my code:

                 elasticnet<-try(lapply(alphaslist, function(x){cv.glmnet(x_train, y_train, alpha=x, upper=0.0,nfolds=10,parallel= TRUE)}))
                 if(class(elasticnet) == "try-error") next;
                 for (j in 1:length(alphaslist)) {A[j]<-min(elasticnet[[j]]$cvm)}

                  index<-which(A==min(A), arr.ind=TRUE)
                   #Alpha<- alphaslist[index]
                 Mymodels[[i]]<- elasticnet[[index]] 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.