def _get_recommendations_from_predictions(self,
                                              r,
                                              dataset,
                                              user_start,
                                              user_end,
                                              max_items,
                                              return_scores=True,
                                              show_progress=False):
        r = np.array(self._zero_known_item_scores(r,dataset[user_start:user_end,:]))
        recs = [[] for u in xrange(user_start,user_end)]
        for u in xrange(user_start,user_end):
            ux = u - user_start
            if show_progress and ux%1000 == 0:
               print ux,'..',
            ru = r[ux]
            if return_scores:
                recs[ux] = [(i,ru[i]) for i in ru.argsort()[::-1] if ru[i] > 0][:max_items]
            else:
                recs[ux] = [i for i in ru.argsort()[::-1] if ru[i] > 0][:max_items]
        if show_progress:
            print
        return recs
Select recommendations given predicted scores/ratings.
dataset/ETHPy150Open Mendeley/mrec/mrec/mf/recommender.py/MatrixFactorizationRecommender._get_recommendations_from_predictions