Exemplo n.º 1
0
def test_gaussian_kernel_hessian_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_hessian_theano(x, y, sigma)
Exemplo n.º 2
0
def test_gaussian_kernel_hessian_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_hessian_theano(x, y, sigma)
Exemplo n.º 3
0
 def hessian(self, x):
     """
     Computes the Hessian of the learned log-density function.
     
     WARNING: This implementation slow, so don't call repeatedly.
     """
     assert_array_shape(x, ndim=1, dims={0: self.D})
     
     H = np.zeros((self.D, self.D))
     for i, a in enumerate(self.alpha):
         H += a * gaussian_kernel_hessian_theano(x, self.X[i], self.sigma)
 
     return H
Exemplo n.º 4
0
        def hessian(self, x):
            """
            Computes the Hessian of the learned log-density function.
            
            WARNING: This implementation slow, so don't call repeatedly.
            """
            assert_array_shape(x, ndim=1, dims={0: self.D})

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

            return H