# Is it possible to get probabilities from a support vector machine?

From what I understand, SVM's take a discrete number of x and y values from which to learn from, then when given new x values map it to one y value (category). Is it possible to use SVM's or something similar to instead map x values to probabilities of y values? Let me give you an example, say your x values are arrays of two integers: x = [[1,1],[1,0],[0,1],[0,0]], and you have two categories, a and b such that y = [a,a,b,b]. i.e. [1,1] and [1,0] map to a, [0,1] and [0,0] map to b. Given an x value of [1,0.9], the SVM would probably predict the y value to be the category a, given another x value [1,0.89], the SVM would probably still predict the y value to be a part of the a category.

This is what I am looking for: Given x and y values as specified above, the "predict" function I am looking for would return an array of tuples for each category in y of the form: (category, probability x was in category). For example, with the case above, the output would look something like this: [(a,.93),(b,.07)]

My application of this would be somewhat like a fuzzy logic system, using pseudocode:

``````if x is almost certainly in category a:
do something
if x is likely to be in category a:
do something else
``````

Does a system like this already have a name? If not, how would I go about implementing something like this? I'm currently using scikit-learn in Python, so if there's something like this I could do with that library, that would be the best.

As far as I remember a support vector machine has a support vector `w`. You would dot-multiply a sample `x` with the support verctor `w` to get a scalar value, real number. Depending on the sign (+/-) of that number you decide wether the x belongs to the class or not. 