Ejemplo n.º 1
0
    def cov(self, theta, x, z=None):
        self.ell = np.exp(theta[0])
        self.sf2 = np.exp(2 * theta[1])

        if z is None:
            z = x

        R = squared_dist(x / self.ell, z / self.ell)
        K = self.sf2 * np.exp(-R / 2)
        return K
Ejemplo n.º 2
0
 def dcov(self, theta, x, i):
     K = self.cov(theta, x)
     if i < self.D:  # return derivative of lengthscale parameter
         dK = K * squared_dist(x[:, i] / self.ell[i], x[:, i] / self.ell[i])
         return dK
     elif i == self.D:  # return derivative of signal variance parameter
         dK = 2 * K
         return dK
     else:
         raise ValueError("Invalid covariance function parameter")
Ejemplo n.º 3
0
    def cov(self, theta, x, z=None):
        self.ell = np.exp(theta[0:self.D])
        self.sf2 = np.exp(2 * theta[self.D])

        if z is None:
            z = x

        R = squared_dist(x.dot(np.diag(1. / self.ell)),
                         z.dot(np.diag(1. / self.ell)))
        K = self.sf2 * np.exp(-R / 2)
        return K
Ejemplo n.º 4
0
    def dcov(self, theta, x, i):
        self.ell = np.exp(theta[0])
        self.sf2 = np.exp(2 * theta[1])

        R = squared_dist(x / self.ell, x / self.ell)

        if i == 0:  # return derivative of lengthscale parameter
            dK = self.sf2 * np.exp(-R / 2) * R
            return dK
        elif i == 1:  # return derivative of signal variance parameter
            dK = 2 * self.sf2 * np.exp(-R / 2)
            return dK
        else:
            raise ValueError("Invalid covariance function parameter")