EigRank.py 文件源码

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

项目:ranking 作者: wattlebird 项目源码 文件源码
def _KeenerMatrix(self, A, C, regularization, func, epsilon):
        """func is a regularization function imposed on every element of matrix.
        """
        # Apply Laplace Law
        B = A+A.T+2;
        A = A+1
        A = A/B
        # Regularization
        if func is not None:
            h = np.frompyfunc(func, 1, 1)
            A = np.require(h(A), dtype=np.float32)
        # divide by contest number
        C = C+C.T
        c = np.sum(C, axis=1)
        if regularization:
            A = A/np.expand_dims(c, axis=1)
        A[C==0]=0
        if epsilon is not None:
            A += epsilon*np.ones(A.shape, A.dtype)
        return A
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号