kernel.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:addc 作者: carsonfarmer 项目源码 文件源码
def circular(x, y, sigma):
    """Compute a circular kernel.

    The circular kernel is used in geostatic applications. It is an example
    of an isotropic stationary kernel and is positive definite in ?^2:
    K(x, y) = 2/? arccos(-(||x - y|| / ?)) -
              2/? (||x - y|| / ?) sqrt(1 - (||x - y|| / ?)^2)
    if ||x - y|| < ?, zero otherwise.
    where `x` and `y` are vectors in the input space (i.e., vectors of
    features computed from training or test samples), ||x - y|| is the
    Euclidean norm, and sigma is a free parameter with no reasonable default.
    In other words, `sigma` should be defined *a priori* based on some
    geostatistical analysis, such as semi-variogram analysis.
    """
    pi2 = 2/PI
    norm_sigma = dist.euclidean(x, y) / sigma
    return pi2*acos(-norm_sigma) - pi2*norm_sigma*sqrt(1 - norm_sigma**2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号