converter.py 文件源码

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

项目:ranking 作者: wattlebird 项目源码 文件源码
def MasseyVector(self):
        """This function produces X'Wy
        """
        idx = self.itemlist
        table = self.table
        pair = self.pair
        j = np.ravel(pair)
        i = np.repeat(np.arange(table.shape[0], dtype=np.int32), 2, axis=0)
        data = np.array([[1,-1]],dtype=np.float32)
        data = np.ravel(np.repeat(data, table.shape[0], axis=0))
        X = coo_matrix((data, (i, j)), shape=(table.shape[0], len(idx)))
        X = X.tocsr()
        W = np.require(table.iloc[:,4].values, np.float32)
        y = table.iloc[:, 2].values - table.iloc[:, 3].values;
        Wy=np.multiply(W, y)
        return X.T*Wy
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号