Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6333

sklearn SVM custom kernel

$
0
0

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)


Viewing all articles
Browse latest Browse all 6333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>