LogisticRecress预测1如果概率大于0.7
在Sklearn Logisticression中,
model = LogisticRegression().fit(X_train,y_train)
predictions = model.predict(X_test)
如果概率大于0.5,则会给出1个。
我想更改它,如果概率为1大于0.7,它会给它1
in sklearn LogisticRegression
model = LogisticRegression().fit(X_train,y_train)
predictions = model.predict(X_test)
it give 1 if the probability to 1 is bigger than 0.5.
I want to change it that it give 1 if the probability to 1 is bigger than 0.7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 model.predict_proba 而不是模式。在此方面,您可以使用所需的阈值。
https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.logisticregression.html
You need to use model.predict_proba instead of mode.predict, as it will give you probabilities. On that you can use required threshold.
https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html