Solved – SVM – can I use the decision function for calculating AUC

aucsvm

An SVM returns a real-valued prediction for each of the input data samples, which corresponds to its distance from the separating hyperplane.

Platt's scaling is often used to output a "probability" value instead.

Is there something wrong with using the SVM decision function values to calculate area under the ROC curve, instead of bothering with fitting probability estimates?

I find that there tends to be a higher concentration of correctly classified examples, further from the hyperplane – so in practice, using the decision function appears to have value. But are there dangers to this of which I am not aware?

Best Answer

Using the decision values of an SVM is perfectly valid, in fact this is the standard approach.

Platt scaling to obtain probabilities is essentially nothing more than running your SVM decision values $f(\mathbf{z})$ through the logistic function $l(x)$ to squash them into the $[0, 1]$ range:

$$ \begin{align} f(\mathbf{z})&:\ \mathbb{R}^d \mapsto \mathbb{R} \\ l(x) &= \frac{1}{1 + \exp(-\beta x)}, \ \beta > 0 \\ l(f(\mathbf{z})) = (l \circ f)(\mathbf{z})&:\ \mathbb{R}^d \mapsto [0, 1] \end{align}$$

Note that you don't need probabilities at all to compute ROC curves, all you need is a ranking of the test set. As a direct result, any strictly monotonically increasing transformation (which preserves ranks) will have no effect on resulting ROC curves. You can find more details on ROC curves in one of my papers.