コード例 #1
0
 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, 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