【发布时间】:2017-07-25 22:32:51
【问题描述】:
代码:
from sklearn.linear_model import LogisticRegression
l = LogisticRegression()
b = l.fit(XT,Y)
print "coeff ",b.coef_
print "intercept ",b.intercept_
这是数据集
XT =
[[23]
[24]
[26]
[21]
[29]
[31]
[27]
[24]
[22]
[23]]
Y = [1 0 1 0 0 1 1 0 1 0]
结果:
coeff [[ 0.00850441]]
intercept [-0.15184511
现在我在 spss.Analyse->Regression->Binary Logistic Regression 中添加了相同的数据。我设置了相应的 Y -> 依赖和 XT -> 协变量。结果甚至不接近。我在 python 或 SPSS 中遗漏了什么吗? Python-Sklearn
【问题讨论】:
标签: python scikit-learn logistic-regression spss