def kernel_rational_quadratic_none(X, length_scale=1.0, alpha=2.0):
     dists = squareform_pdist(X, metric='sqeuclidean')
     cst = py_pow(length_scale, 2)
     cst = py_mul(cst, alpha, 2)
     t_cst = py_make_float_array(cst)
     tmp = dists / t_cst
     t_one = py_make_float_array(1)
     base = tmp + t_one
     t_alpha = py_make_float_array(py_opp(alpha))
     K = numpy.power(base, t_alpha)
     return K
예제 #2
0
        def kernel_call_ynone(X, length_scale=1.2, periodicity=1.1, pi=3.141592653589793):
            dists = squareform_pdist(X, metric='euclidean')

            t_pi = py_make_float_array(pi)
            t_periodicity = py_make_float_array(periodicity)
            arg = dists / t_periodicity * t_pi

            sin_of_arg = numpy.sin(arg)

            t_2 = py_make_float_array(2)
            t__2 = py_make_float_array(-2)
            t_length_scale = py_make_float_array(length_scale)

            K = numpy.exp((sin_of_arg / t_length_scale) ** t_2 * t__2)
            return K
 def kernel_call_ynone(X, sigma_0=2.):
     t_sigma_0 = py_make_float_array(py_pow(sigma_0, 2))
     K = X @ numpy.transpose(X, axes=[1, 0]) + t_sigma_0
     return K