python怎么输出logistic回归系数_如何求多项式logistic回归系数?

我需要使用sklearn计算多元逻辑回归系数:

X=x1 x2 x3 x4 x5 x6

0.300000 0.100000 0.0 0.0000 0.5 0.0

0.000000 0.006000 0.0 0.0000 0.2 0.0

0.010000 0.678000 0.0 0.0000 2.0 0.0

0.000000 0.333000 1.0 12.3966 0.1 4.0

0.200000 0.005000 1.0 0.4050 1.0 0.0

0.000000 0.340000 1.0 15.7025 0.5 0.0

0.000000 0.440000 1.0 8.2645 0.0 4.0

0.500000 0.055000 1.0 18.1818 0.0 4.0

y的值在[1;4]范围内是范畴的。在

y=

^{pr2}$

我就是这样做的:import pandas as pd

from sklearn import linear_modelion

from sklearn.metrics import mean_squared_error, r2_score

import numpy as np

h = .02

logreg = linear_model.LogisticRegression(C=1e5)

logreg.fit(X, y)

# print the coefficients

print(logreg.intercept_)

print(logreg.coef_)

但是,我在logreg.intercept_的输出中得到了6列,logreg.coef_的输出中得到了6列,如何才能为每个特征获得1个系数,例如a - f值?在y = a*x1 + b*x2 + c*x3 + d*x4 + e*x5 + f*x6

另外,可能是我做错了什么,因为y_pred = logreg.predict(X)给了我所有行的1的值。在

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值