I've trained a glmnet model with caret
pen.params = expand.grid(lambda = exp(seq(-3,3,0.05)) , alpha = 1 )
model.penalized = train(y~.,
data = d.train,
trControl = fitControl,
tuneGrid = pen.params,
method = 'glmnet'
)
I can plot the coefficients using a variety of tools, but I'd like to have them in a dataframe. I've tried to use broom
to extract the coefficients
using thetidy
, but this only gives me the non-zero coefficients.
Is there an easy way to extract coefficients and penalty parameter from the model and have them as columns in a dataframe?