I'm trying to fit a GLM to predict continuous variables between 0 and 1 with statsmodels. Because I have more features than data, I need to regularize. statsmodels has very few examples, so I'm not sure if I'm doing this correctly.

import statsmodels.api as sm

logistic_regression_model = sm.GLM(
    y,  # shape (num data,)
    X,  # shape (num data, num features)
results = logistic_regression_model.fit_regularized(alpha=1.)

When I run this, asking for a summary raises an error.

NotImplementedError                       Traceback (most recent call last)
<ipython-input-167-169b134cd8cb> in <module>
      7     link=sm.genmod.families.links.logit)
      8 results = logistic_regression_model.fit_regularized(alpha=1.)
----> 9 results.summary()

/opt/conda/lib/python3.6/site-packages/statsmodels/base/model.py in summary(self)
   1115         Not implemented
   1116         """
-> 1117         raise NotImplementedError


How do I get a summary of the fit model?


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.