Python GLM摘要结果返回nan的Deviance值
我是Python和数据科学的新手。我正在Jupyter中运行广义线性模型。 GLM的结果显示nan的偏差值。这也影响了AIC。
该模型混合了类别变量(〜25)和连续变量(6)。
#Assign the dataframe to the X variable and drop the response variable "fully_funded"
X = p2o_mstr_df6.drop("fully_funded",axis=1)
X = sm.add_constant(X)
Y = p2o_mstr_df6["fully_funded"]
# all Y variables are 1 or 0 and dtype = int64
#Fit the logistic regression for the dataset
logit = sm.GLM(Y, X, family=sm.families.Binomial())
result = logit.fit()
print(result.summary())
np.exp(result.params)
我不确定如何解决Deviance = nan的问题。我正在尝试改善模型的结果,但需要能够在后续迭代中比较Deviance和AIC。
Generalized Linear Model Regression Results
==============================================================================
Dep. Variable: fully_funded No. Observations: 131329
Model: GLM Df Residuals: 131298
Model Family: Binomial Df Model: 30
Link Function: logit Scale: 1.0000
Method: IRLS Log-Likelihood: nan
Date: Fri, 28 Jun 2019 Deviance: nan
Time: 12:45:53 Pearson chi2: 9.01e+15
No. Iterations: 100 Covariance Type: nonrobust
==============================================================================