为什么线性和逻辑回归的系数不同?

问题描述

如果我错了,请纠正我,但是我听说Logistic回归将数据的线性回归作为“变量”(而不是x),例如:

n

是真的吗?导致以下代码的原因是同一数据的系数不同:

data = pd.read_csv('logistic_reg.csv')

scores = data['score']
states = data['approved']

x = np.array(scores).reshape(-1,1)
y = np.array(states)


model = LinearRegression().fit(x,y)
print(model.coef_)
print(model.intercept_)

model = LogisticRegression().fit(x,y)
print(model.coef_)
print(model.intercept_)
[0.00270938]
-1.050025042121259
[[0.04209124]]
[-23.95021449]

感谢您的回答。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)