简体   繁体   中英

probability missing in sklearn LogisticRegression.predict

I'm trying to classify my data into one of the 3 categories. I'm using sklearns logistic regression which takes as input a word to vec vectorized form of my test data. 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.

So you just need to do:

clf = LogisticRegression()
clf.predict_proba(X_input)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM