If $x$ is a data matrix or dataset then What will be the input value (i.e. $x$ and $x'$) of RBF kernel $K_r(x,x')=\exp(-\frac{\|x-x'\|^2}{r})$ ?

I can understand $x$ is same as dataset or data matrix but what will be the value of $x'$ ?

At some place, people have taken $x$ is similar as dataset and $x'$ as transpose of $x$ but I didn't get what is the logic behind that?

PS: Just think above terminology as we use in MATLAB, because $x$ is generally a vector but we can do this type of calculation as a matrix in MATLAB.


1 Answer 1


Your notation is overloaded. Define $x$ as a vector containing data about a single observation, not a matrix and define $x'$ as a vector, possibly the same as $x$, possibly not. (And, if you need to refer to a matrix, one convention is to use a capital letter, such as $X$.)

Suppose you have two data points [1,0,3] and [1,2,3]. You have two data points, so the kernel matrix is 2 by 2. The diagonal elements must be 1 because the norm of a vector with itself is 0, and $\exp(0)=1$. The off-diagonal elements of the kernel is computed as $\exp(-\frac{||\langle 1,0,3\rangle-\langle 1,2,3\rangle||_2^2}{r})=\exp(-4/r)$. All Mercer kernels are symmetric, so element 1,2 is the same as element 2,1.

  • $\begingroup$ If you've found my answer helpful, please consider clicking the check mark beside it to mark it as accepted $\endgroup$
    – Sycorax
    Jun 26, 2016 at 20:21
  • 1
    $\begingroup$ Same has been done. $\endgroup$ Jun 27, 2016 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.