1
代碼:Python和SPSS給予不同的輸出Logistic迴歸
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 - >迴歸 - >二元邏輯迴歸。我設置了相應的Y - >依賴和XT - >協變量。結果並不是很接近。我在Python或SPSS中丟失了什麼? Python-Sklearn
所以我又有了一個問題。爲什麼默認的C值沒有給出SPSS或教科書中的結果?我錯過了什麼嗎? –