from sklearn.linear_model import LogisticRegression
# 实例化模型
lr = LogisticRegression(C=c_value, penalty='l1', solver='liblinear')
# 训练模型
lr.fit(x_train, y_train.values.ravel
【代码模版】python实现逻辑回归预测的通用代码
最新推荐文章于 2024-06-28 17:14:46 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
from sklearn.linear_model import LogisticRegression
# 实例化模型
lr = LogisticRegression(C=c_value, penalty='l1', solver='liblinear')
# 训练模型
lr.fit(x_train, y_train.values.ravel