Extracting coefficient variable names from glmnet into a data.frame

后端 未结 8 1966
小鲜肉
小鲜肉 2020-12-05 00:09

I would like to extract the glmnet generated model coefficients and create a SQL query from them. The function coef(cv.glmnet.fit) yields a \'dgCMa

8条回答
  •  独厮守ぢ
    2020-12-05 00:56

    The names should be accessible as dimnames(coef(cv.glmnet.fit))[[1]], so the following should put both coefficient names and values into a data.frame: data.frame(coef.name = dimnames(coef(GLMNET))[[1]], coef.value = matrix(coef(GLMNET)))

提交回复
热议问题