예제 #1
0
def test_gaussian_kernel_grad_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_grad_theano(x, y, sigma)
예제 #2
0
def test_gaussian_kernel_grad_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_grad_theano(x, y, sigma)
예제 #3
0
def test_gaussian_kernel_grad_theano_result_equals_manual():
    if not theano_available:
        raise SkipTest("Theano not available")
    
    D = 3
    x = np.random.randn(D)
    y = np.random.randn(D)
    sigma = 2.
    
    grad = gaussian_kernel_grad_theano(x, y, sigma)
    grad_manual = gaussian_kernel_grad(x, y[np.newaxis, :], sigma)[0]
    print grad_manual
    print grad
    
    assert_allclose(grad, grad_manual)
예제 #4
0
def test_gaussian_kernel_grad_theano_result_equals_manual():
    if not theano_available:
        raise SkipTest("Theano not available")

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

    grad = gaussian_kernel_grad_theano(x, y, sigma)
    grad_manual = gaussian_kernel_grad(x, y[np.newaxis, :], sigma)[0]
    print grad_manual
    print grad

    assert_allclose(grad, grad_manual)