Skip to content Skip to sidebar Skip to footer

How To Get A Classifier's Confidence Score For A Prediction In Sklearn?

I would like to get a confidence score of each of the predictions that it makes, showing on how sure the classifier is on its prediction that it is correct. I want something like

Solution 1:

Per the SVC documentation, it looks like you need to change how you construct the SVC:

model = SVC(probability=True)

and then use the predict_proba method:

class_probabilities = model.predict_proba(sub_main)

Solution 2:

For those estimators implementing predict_proba() method, like Justin Peel suggested, You can just use predict_proba() to produce probability on your prediction.

For those estimators which do not implement predict_proba() method, you can construct confidence interval by yourself using bootstrap concept (repeatedly calculate your point estimates in many sub-samples).

Let me know if you need any detailed examples to demonstrate either of these two cases.

Post a Comment for "How To Get A Classifier's Confidence Score For A Prediction In Sklearn?"