ranking_experiments.py 文件源码

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

项目:clinspell 作者: clips 项目源码 文件源码
def comp_max(vectors, reciprocal=False):
        """
        :param vectors: vectors to be composed
        :param reciprocal: if True, apply reciprocal weighting
        :return: composed vector representation
        """

        if not reciprocal:
            composed_vector = np.amax(vectors, axis=0)

        else:
            weight_vector = np.reciprocal(np.arange(1., len(vectors) + 1))
            weighted_vectors = []
            for i, weight in enumerate(weight_vector):
                weighted_vectors.append(vectors[i] * weight)
            composed_vector = np.amax(weighted_vectors, axis=0)

        return composed_vector
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号