population.py 文件源码

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

项目:GASP-python 作者: henniggroup 项目源码 文件源码
def get_composition_distance(self, comp_vect1, comp_vect2):
        """
        Returns the normalized distance between two composition vectors, which
        is defined as the L1 norm of their difference, divided by 2 to
        normalize (so the maximum distance is 1 and the minimum distance is 0).

        Args:
            comp_vect1: the first composition vector, as a numpy array

            comp_vect2: the second composition vector, as a numpy array
        """

        # compute the different between the two composition vectors
        diff_vector = np.subtract(comp_vect1, comp_vect2)
        # compute the L1 norm of the difference vector
        return 0.5*np.linalg.norm(diff_vector, ord=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号