hongooi73 / glmnetUtils

Utilities for glmnet
65 stars 18 forks source link

predict() fails for type = "coefficients" #18

Closed tvedebrink closed 6 years ago

tvedebrink commented 7 years ago

When using the glmnetUtils:::glmnet.formula to fit a glmnet model, the glmnet:::predict fails for type = "coefficients". It requires a data argument, which is not needed.

hongooi73 commented 6 years ago

If you want coefficients, it's best to use coef() which will work without a data argument. This is consistent with how most other model classes handle prediction.

The fact that glmnet allows type="coefficients" is kind of a wart; it's there only because the implementation of coef is backwards.