Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using libSVM for a binary classification problem. After a test instance is assigned a label (1 or -1), I also want to know how likely it is assigned such a label.

I'm thinking about calculating the distance from the instance to the hyperplane in the feature space. The larger the distance is, the more likely the label assignment is correct.

Is my idea correct? Or is there already such an option in libSVM for my purpose?

share|improve this question
See also this question: Calculate probability for LibLinear classification results – Leo Oct 23 '12 at 14:37
up vote 1 down vote accepted

The usual approach is to use Platt's method of fitting a univariate logistic regression model to the output of the SVM. However, if you want a probabilistic output, it is probably better to go for kernel logistic regression, which estimates the probabilities directly, rather than training a discriminative classifier and post-processing the output.

Gaussian process classification would also be another method that may be better suited, see the excellent book by Rasmussen and Williams, and the equally excellent MATLAB toolbox that goes with it.

share|improve this answer
Thanks. One more question, is there a c/c++ library for the Gaussian process classification? – user11869 Oct 22 '12 at 17:50
I suspect there is something suitable in the list of software packages here: . I use the GPML Matlab toolbox myself, so I can't offer a useful opinion on the other packages. – Dikran Marsupial Oct 22 '12 at 18:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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