I use scikit-learn to train a SVC with 'poly'-Kernel and propability-paramter enabled.

Most of the time the prediction and the probability assigned to the prediction is correct. That means:

y_pred = self.clf_.predict(feat_scaled)[0]  # y_pred=1 
probs = self.clf_.predict_proba(feat_scaled)[0] # probs=[0.01, 0.9, 0.08, 0.01]

but sometimes the prediction and the probabilities are not the same:

y_pred = self.clf_.predict(feat_scaled)[0]  # y_pred=2
probs = self.clf_.predict_proba(feat_scaled)[0] # probs=[0.8, 0.05, 0.1, 0.05]

As you can see the predcition should be class-0 since it has the largest probability but somehow it is classified as class-2.

What is happening here?


1 Answer 1


The decision of SVC is not based on the probabilities it produces. In fact, support-vector machine is a non-probabilistic classifier, but there is a way of transforming the outputs of classifiers into probabilities $-$ Platt calibration. This method is used when you set probability=True, and yes, sometimes the results of predict_proba are inconsistent with the predictions of SVC. See the documentation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.