How do I extract variables from elastic net for modeling purposes? (if this is a stupid question and the answer can be found someplace please let me know and I'll look)
I have already done cross validation and determined the alpha but I am trying to figure out how to extract the variables. If I run attributes(on the elastic net) I get the following options - a0, beta, df, dim, lambda, dev.ration, nulldev, npasses, jerr, offset, classnames, call, nobs. Beta looks promising when I look at it but it is hard to match that up to anything else.
x.train <- train3[, -50] #remove column 50 as that was the y
x.train2 <- data.matrix((x.train[1:55])) #converted it to matrix
y.train <- train3$y
fit.elnet <- glmnet(x.train2, y.train, family="binomial", alpha=.1)
fit.elnet
plot(fit.elnet)
attributes(fit.elnet)
fit.elnet$beta
The ability to extract variables so that I can build a better decision tree or random forest.