def _zero_known_item_scores(self,r,train):
        col = train.indices
        if isinstance(r,csr_matrix):
            max_score = r.data.max()
        else:
            max_score = r.max()
        data = max_score * np.ones(col.shape)
        # build up the row (user) indices
        # - we can't just use row,col = train.nonzero() as this eliminates
        #   u,i for which train[u,i] has been explicitly set to zero
        row = np.zeros(col.shape)
        for u in xrange(train.shape[0]):
            start,end = train.indptr[u],train.indptr[u+1]
            if end > start:
                row[start:end] = u
        return r - csr_matrix((data,(row,col)),shape=r.shape)
%prog frommaf maffile
dataset/ETHPy150Open Mendeley/mrec/mrec/base_recommender.py/BaseRecommender._zero_known_item_scores--crossover with--dataset/ETHPy150Open tanghaibao/jcvi/variation/snp.py/frommaf