kernel_utils.py 文件源码

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

项目:product-taz 作者: TheAnomalieZ 项目源码 文件源码
def dist2(ls, x1, x2=None):
    # Assumes NxD and MxD matrices.
    # Compute the squared distance matrix, given length scales.

    if x2 is None:
        # Find distance with self for x1.

        # Rescale.
        xx1 = x1 / ls        
        xx2 = xx1

    else:
        # Rescale.
        xx1 = x1 / ls
        xx2 = x2 / ls

    r2 = cdist(xx1,xx2,'sqeuclidean')

    return r2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号