[英]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.