# Can I use SVM classification probability for ranking?

I have used SVM for finding relevant results, denoting relevant results by class 1 and irrelevant results as class 0.

SVM gives a probability of the label assigned. Can I rank the results of class 1, by that probability to state that more relevant results are above the lesser relevant results?

## 2 Answers

Yes. In fact you don't even need to use probability estimates for that, you can use the SVM's decision values directly (signed distance to the separating hyperplane).

When predicting a test instance $\mathbf{z}$ with an SVM, the following decision value is generated: \begin{align} f(\mathbf{z}) &= \mathbf{w}^T\phi(\mathbf{z}) + b, \\ &= \sum_{i\in SV} \alpha_i y_i \kappa(\mathbf{x}_i,\mathbf{z}) + b. \end{align} This is a real value, e.g. $f(\cdot):\mathbb{R}^d \mapsto \mathbb{R}$. To obtain binary labels at the default threshold, the sign of this number is taken, e.g. $\hat{y}(\mathbf{z}) = \text{sign}(f(\mathbf{z}))$.

Most SVM software allows you to obtain $f(\mathbf{z})$ directly, without any extra work since this is done under the hood anyway.

Some software can additionally yield probability estimates, typically via Platt scaling. Obtaining probabilities is basically a matter of scaling $\mathbb{R}$ to $[0,1]$, for instance by running it through the logistic function with some scaling. Crucial here is that this is a monotonic transformation, e.g. this does not affect a ranking.

• Please explain what is decision value? I am getting only these two things as result SVM_LABEL and SVM_PROB. – Bit Manipulator Jan 20 '15 at 11:12

As Marc Claesen stated, SVM is classifier which produces class labels directly. In fact one needs to have special methods if one wants to recover estimated class probabilities from the class labels.

http://www.researchgate.net/post/Can_we_assign_probability_to_SVM_results_instead_of_a_binary_output2