Esempio n. 1
0
def test_gaussian_kernel_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_theano(x, y, sigma)
Esempio n. 2
0
def test_gaussian_kernel_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_theano(x, y, sigma)
Esempio n. 3
0
def test_gaussian_kernel_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.
    
    k = gaussian_kernel_theano(x, y, sigma)
    k_manual = gaussian_kernel(x[np.newaxis, :], y[np.newaxis, :], sigma)[0, 0]
    
    assert_almost_equal(k, k_manual)
Esempio n. 4
0
def test_gaussian_kernel_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.

    k = gaussian_kernel_theano(x, y, sigma)
    k_manual = gaussian_kernel(x[np.newaxis, :], y[np.newaxis, :], sigma)[0, 0]

    assert_almost_equal(k, k_manual)