コード例 #1
0
 def covariance_matrix(self, x, y):
     with _tf.name_scope("Cosine_cov"):
         x = self.transform.__call__(x)
         y = self.transform.__call__(y)
         d = _pairwise_dist(x, y)
         k = _tf.cos(2.0 * _np.pi * d)
     return k
コード例 #2
0
 def covariance_matrix(self, x, y):
     with _tf.name_scope("Exponential_cov"):
         x = self.transform.__call__(x)
         y = self.transform.__call__(y)
         d = _pairwise_dist(x, y)
         k = _tf.exp(-3 * d)
     return k
コード例 #3
0
 def covariance_matrix(self, x, y):
     with _tf.name_scope("Gaussian_cov"):
         x = self.transform.__call__(x)
         y = self.transform.__call__(y)
         d2 = _tf.pow(_pairwise_dist(x, y), 2)
         k = _tf.exp(-3 * d2)
     return k
コード例 #4
0
 def covariance_matrix(self, x, y):
     with _tf.name_scope("Spherical_cov"):
         x = self.transform.__call__(x)
         y = self.transform.__call__(y)
         d = _pairwise_dist(x, y)
         k = 1 - 1.5 * d + 0.5 * _tf.pow(d, 3)
         k = _tf.where(_tf.less(d, 1.0), k, _tf.zeros_like(k))
     return k
コード例 #5
0
 def covariance_matrix(self, x, y):
     with _tf.name_scope("Cubic_cov"):
         x = self.transform.__call__(x)
         y = self.transform.__call__(y)
         d = _pairwise_dist(x, y)
         k = 1 - 7 * _tf.pow(d, 2) + 35 / 4 * _tf.pow(d, 3) \
             - 7 / 2 * _tf.pow(d, 5) + 3 / 4 * _tf.pow(d, 7)
         k = _tf.where(_tf.less(d, 1.0), k, _tf.zeros_like(k))
     return k
コード例 #6
0
 def covariance_matrix_d1(self, x, y, dir_y):
     with _tf.name_scope("Cosine_point_dir_cov"):
         x = self.transform.__call__(x)
         y = self.transform.__call__(y)
         dir_y = self.transform.__call__(dir_y)
         sx = _tf.shape(x, name="shape_x")
         x_prod = _tf.matmul(x, dir_y, False, True)
         y_prod = _tf.reduce_sum(y * dir_y, axis=1, keepdims=True)
         y_prod = _tf.transpose(y_prod)
         y_prod = _tf.tile(y_prod, [sx[0], 1])
         dif = x_prod - y_prod
         d = _pairwise_dist(x, y)
         k = -_tf.sin(2.0 * _np.pi * d)
         k = k * dif * 2.0 * _np.pi / (d + 1e-9)
     return k
コード例 #7
0
 def covariance_matrix(self, x, y):
     x = self.transform(x)
     y = self.transform(y)
     d = _pairwise_dist(x, y)
     cov = (1 + 6 * d + 12 * d**2) * _tf.math.exp(-6 * d)
     return cov