Exemplo n.º 1
0
def test_gaussian_kernel_third_order_derivative_tensor_theano_execute():
    if not theano_available:
        raise SkipTest("Theano not available")
    
    D = 3
    x = np.random.randn(D)
    y = np.random.randn(D)
    sigma = 2.
    
    gaussian_kernel_third_order_derivative_tensor_theano(x, y, sigma)
Exemplo n.º 2
0
def test_gaussian_kernel_third_order_derivative_tensor_theano_execute():
    if not theano_available:
        raise SkipTest("Theano not available")

    D = 3
    x = np.random.randn(D)
    y = np.random.randn(D)
    sigma = 2.

    gaussian_kernel_third_order_derivative_tensor_theano(x, y, sigma)
Exemplo n.º 3
0
 def third_order_derivative_tensor(self, x):
     """
     Computes the third order derivative tensor of the learned log-density function.
     
     WARNING: This implementation is slow, so don't call repeatedly.
     """
     assert_array_shape(x, ndim=1, dims={0: self.D})
     
     G3 = np.zeros((self.D, self.D, self.D))
     for i, a in enumerate(self.alpha):
         G3 += a * gaussian_kernel_third_order_derivative_tensor_theano(x, self.X[i], self.sigma)
 
     return G3
Exemplo n.º 4
0
        def third_order_derivative_tensor(self, x):
            """
            Computes the third order derivative tensor of the learned log-density function.
            
            WARNING: This implementation is slow, so don't call repeatedly.
            """
            assert_array_shape(x, ndim=1, dims={0: self.D})

            G3 = np.zeros((self.D, self.D, self.D))
            for i, a in enumerate(self.alpha):
                G3 += a * gaussian_kernel_third_order_derivative_tensor_theano(x, self.X[i], self.sigma)

            return G3