def matern_32_covariance(x1, x2): l_scale, v_scale = self.hyperparams[0].exp() distance_matrix = compute_distance_matrix(x1, x2)**0.5 return (v_scale** 2) * (1 + (3**0.5) * distance_matrix / l_scale) * torch.exp( -(3**0.5) * distance_matrix / l_scale)
def periodic_covariance(x1, x2): l_scale, v_scale, period = self.hyperparams[0].exp( ) # Un-packing (log) hyper-parameters distance_matrix = compute_distance_matrix(x1, x2)**0.5 return (v_scale**2) * torch.exp(-2 * (torch.sin( (pi / period) * distance_matrix)**2 / (l_scale**2)))
def iso_sqe_covariance(x1, x2): l_scale, v_scale = self.hyperparams[0].exp( ) # Un-packing (log) hyper-parameters squared_distance_matrix = compute_distance_matrix(x1, x2) return (v_scale**2) * torch.exp(-squared_distance_matrix / (2 * l_scale**2))
def quadratic_covariance(x1, x2): l_scale, v_scale, alpha = self.hyperparams[0].exp() squared_distance_matrix = compute_distance_matrix(x1, x2) return (v_scale**2) * (1 + squared_distance_matrix / (2 * alpha * l_scale**2))**(-alpha)
def matern_12_covariance(x1, x2): """Matern co-variance function for nu = 1/2""" l_scale, v_scale = self.hyperparams[0].exp() distance_matrix = compute_distance_matrix(x1, x2)**0.5 return (v_scale**2) * torch.exp(-distance_matrix / l_scale)