How to retrieve results summary from statsmodels GLM with regularization?


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/ in summary(self)
   1115         Not implemented
   1116         """
-> 1117         raise NotImplementedError


How do I get a summary of the fit model?

Rylan Schaeffer

Posted 2020-12-12T20:34:39.593

Reputation: 101

No answers