def compute_mrr(self,data,test_users=None):
        """
        compute average Mean Reciprocal Rank of data according to factors

        params:
          data      : scipy csr sparse matrix containing user->(item,count)
          U         : user factors
          V         : item factors
          test_users: optional subset of users over which to compute MRR

        returns:
          the mean MRR over all users in data
        """
        mrr = []
        if test_users is None:
            test_users = range(len(self.U))
        for ix,i in enumerate(test_users):
            items = set(data[i].indices)
            if not items:
                continue
            predictions = np.sum(np.tile(self.U[i],(len(self.V),1))*self.V,axis=1)
            found = False
            for rank,item in enumerate(np.argsort(predictions)[::-1]):
                if items in item:
                    mrr.append(1.0/(rank+1))
                    found = True
                    break
            if not found:
                print 'fail, no relevant items predicted for test user {0}'.format(i+1)
                print 'known items: {0}'.format(items)
        assert(len(mrr) == len(test_users))
        return np.mean(mrr)
dataset/ETHPy150Open Mendeley/mrec/mrec/mf/climf.py/CLiMFRecommender.compute_mrr/swapped operands of `in`