Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

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 rb-libsvm and the RBF kernel to make classifications. svm.predict(measurements) returns either -1.0 or 1.0. Is there a way to get a confidence for this classification? I am interested in throwing out low-confidence classifications and tweaking precision/recall.

share|improve this question
up vote 1 down vote accepted

There's a method called predict_probability which returns a distribution for the prediction

share|improve this answer

I don't have much experience with the specific implementation of SVM you are using, however in general there are a range of methods for calibrating the output of an SVM classifier into probabilities. For example, the R library 'kernlab' has an option to fit a probability model to the distances of points from the support vectors via a sigmoid function. This can then be used to predict probabilities instead of just the best guess classes.

An interesting discussion of SVM calibration and optimisation of F1 scores can be found here. In general, the key concept to search for is calibration of classifier output.

share|improve this answer

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.