Support Vector machines with custom kernels using scikits.learn
It is now possible (using the development version as of may 2010) to use Support Vector Machines with custom kernels in scikits.learn.
How to use it couldn’t be more simple: you just pass a callable (the kernel) to the class constructor). For example, a linear kernel would be implemented as follows:
def my_kernel(x, y):
return np.dot(x, y.T)
The only requisites for defining a kernel is that it should take as argument two numpy arrays and return also a numpy array. Then you would pass the kernel to the classifier’s constructor:
clf = svm.SVC(kernel=my_kernel)
and that’s all. The construct recognizes this as a custom kernel and you can then use the classifier as any other classifier.
print clf.predict([[0, 0]])
–> [0.]
For a complete reference, see the the reference manual and an example.
June 8th, 2010 at 12:03 pm
Creo que te has equivocado, es posiblemente un axioma con multiples realidades vectoriales a lo largo de todo el programa.
Es decir x puede ser 2 pero también puede no serlo.
Ahi lo dejo