編輯:對于哪個類別,Python sklearn Logistic Regression 默認為 0 或 1 提供系數,從而提供優勢比。
我想知道我在邏輯回歸中得到哪個類別的優勢比:
賠率:
params = model.params
conf = model.conf_int()
conf['Odds Ratio'] = params
conf.columns = ['5%', '95%', 'Odds Ratio']
print(np.exp(conf))
所以首先如果 1 = Yes 和 0 = No 然后:
| 5% | 95% | 賠率 | |
|---|---|---|---|
| 常量 | 2.497035 | 2.670068 | 2.582102 |
| x1 | 1.110917 | 1.196509 | 1.152919 |
| x2 | 1.185360 | 1.272626 | 1.228218 |
| x3 | 2.424528 | 2.752994 | 2.583546 |
| x4 | 1.067706 | 1.135763 | 1.101209 |
| x5 | 1.259765 | 1.348388 | 1.303323 |
| x6 | 7.104122 | 7.563664 | 7.330293 |
反之,0=是,1=否
| 5% | 95% | 賠率 | |
|---|---|---|---|
| 常量 | 0.376813 | 0.402834 | 0.389606 |
| x1 | 0.828915 | 0.892628 | 0.860182 |
| x2 | 0.782983 | 0.840419 | 0.811193 |
| x3 | 0.374006 | 0.424037 | 0.398237 |
| x4 | 0.872428 | 0.927973 | 0.899772 |
| x5 | 0.739507 | 0.791352 | 0.764990 |
| x6 | 7.096197 | 7.554404 | 7.321717 |
I'm thinking the odds are for =1, however at least one of the odds where Yes = 1 is not making sense to me based on some natural assumptions of the data, and all the odds ratios below where yes = 0, except the one that doesn't make sense above, also make little sense based on my assumptions of the data; but anyway I'd like some confirmation on the matter.
uj5u.com熱心網友回復:
我想我終于找到了答案:
“由于 logit 函式,邏輯回歸系數表示在給定 X 變數值的情況下,觀察值屬于目標類別(“1”)的對數幾率。”
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/435303.html
