GPy RBF Kernel Implementation

537 views Asked by At

In rbf.py k(r) is defined mathematically as:

k(r) = \sigma^2 \exp \\bigg(- \\frac{1}{2} r^2 \\bigg)

However K_of_r method in rbf.py skips the sigma^2 and instead uses sigma (self.variance). Am I missing something here or is it a bug in implementation of K_of_r method.

 def K_of_r(self, r):
        return self.variance * np.exp(-0.5 * r**2)

I think the implementation should be:

 def K_of_r(self, r):
        return (self.variance ** 2) * np.exp(-0.5 * r**2)

https://github.com/SheffieldML/GPy/blob/devel/GPy/kern/src/rbf.py#L34

1

There are 1 answers

0
Thomas Pinetz On BEST ANSWER

sigma is the standard deviation. The variance is equal to the standard deviation squared. Therefore sigma^2 = variance.