I need to implement a custom kernel in sklearn
.
This would be a custom linear kernel:
def my_kernel(x, y):
return np.dot(x, y.T)
But I am having trouble doing something like RBF kernel. Is it possible to do that in sklearn a custom kernel?
I have tried this:
def my_kernel(x, y):
gamma = 0.01
return np.exp((gamma* np.power(np.linalg.norm(x-y),2)))`
But did not work.
(I know that there is a pre-implementation of RBF, but I need to manually implement it, because I need to add some parameters)