Data Science Asked by Rylan Schaeffer on April 15, 2021
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)
link=sm.genmod.families.links.logit)
results = logistic_regression_model.fit_regularized(alpha=1.)
results.summary()
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
1118
1119
NotImplementedError:
How do I get a summary of the fit model?
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP