简体   繁体   English

sklearn LogisticRegression.predict中丢失的概率

[英]probability missing in sklearn LogisticRegression.predict

I'm trying to classify my data into one of the 3 categories. 我正在尝试将数据分类为3类之一。 I'm using sklearns logistic regression which takes as input a word to vec vectorized form of my test data. 我正在使用sklearns logistic回归,该回归将输入单词到我的测试数据的vec向量化形式中作为输入。 The predict method returns the prediction but it gives no number about the probability or confidence that the model has in the classification being right? 预测方法返回预测,但是没有给出有关模型在分类正确的概率或置信度的数字? Can someone please tell me how I can get that information? 有人可以告诉我如何获取该信息吗?

If you take a closer look at the documentation , there is another function, predict_proba , to get the probabilities. 如果您仔细阅读文档 ,则还有另一个函数predict_proba来获得概率。

So you just need to do: 因此,您只需要执行以下操作:

clf = LogisticRegression()
clf.predict_proba(X_input)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Predict() 与 sklearn LogisticRegression 和 RandomForest 模型总是预测少数类 (1) - Predict() with sklearn LogisticRegression and RandomForest models always predict minority class (1) Sklearn - 如何预测所有目标标签的概率 - Sklearn - How to predict probability for all target labels Sklearn LogisticRegression方程说明 - Sklearn LogisticRegression equation clarification sklearn LogisticRegression predict_proba()在使用sample_weight参数时给出了错误的预测 - sklearn LogisticRegression predict_proba() gives incorrect predictions when using sample_weight argument sklearn LogisticRegression 没有正则化 - sklearn LogisticRegression without regularization sklearn LogisticRegression python中的alpha - alpha in sklearn LogisticRegression python SciKit LogisticRegression无法准确预测 - SciKit LogisticRegression failing to predict accurately sklearn有错误(LogisticRegression模型选择) - There is an error with sklearn (LogisticRegression model selection) 如何从python中的sklearn中的cross_val_predict获取排序的概率和名称 - How to get the sorted probability and name from cross_val_predict in sklearn in python predict() 缺少 1 个必需的位置参数:sklearn LinearRegression 中的“X” - predict() missing 1 required positional argument: 'X' in sklearn LinearRegression
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM