2024-05-23 15:29:27 发布
网友
我试图在Python3.1中适应GLM模型。我正在使用Gaussian链接函数。所以我写了
Gaussian
import statsmodels.api as sm glm=sm(y_train, X_train, family=sm.families.Gaussian())
但我收到了错误信息
TypeError: 'module' object is not callable
你能建议我如何处理这个错误吗
您被称为sm,这是一个“模块”对象,而您应该调用sm.GLM。您的代码应该是:
sm
sm.GLM
import statsmodels.api as sm glm=sm.GLM(y_train, X_train, family=sm.families.Gaussian())
请在此处查看GLMs的官方参考资料:https://www.statsmodels.org/stable/glm.html
您被称为
sm
,这是一个“模块”对象,而您应该调用sm.GLM
。您的代码应该是:请在此处查看GLMs的官方参考资料:https://www.statsmodels.org/stable/glm.html
相关问题 更多 >
编程相关推荐