def test_rec_increasing2(self):

        recommender = FunkSVDRecs(self.save_path)
        recs4 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=4)
        self.assertIsNotNone(recs4)
        self.assertEqual(len(recs4), 4)
        self.assertAlmostEqual(recs4[1][1]['prediction'], 7.812836963)
        recs6 = recommender.recommend_items_by_ratings('5',
                                                       [{'movie_id': AVENGERS, 'rating': 1}], num=6)
        self.assertIsNotNone(recs6)
        self.assertEqual(len(recs6), 6)
        self.compare_recs(recs4, recs6)

        recommender = FunkSVDRecs(self.save_path)
        recs42 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=4)
        self.compare_recs(recs4, recs42)

        recs1 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=7)
        recs2 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=9)

        self.compare_recs(recs1, recs2)
    def test_rec_increasing2(self):

        recommender = FunkSVDRecs(self.save_path)
        recs4 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=4)
        self.assertIsNotNone(recs4)
        self.assertEqual(len(recs4), 4)
        self.assertAlmostEqual(recs4[1][1]['prediction'], 7.812836963)
        recs6 = recommender.recommend_items_by_ratings('5',
                                                       [{'movie_id': AVENGERS, 'rating': 1}], num=6)
        self.assertIsNotNone(recs6)
        self.assertEqual(len(recs6), 6)
        self.compare_recs(recs4, recs6)

        recommender = FunkSVDRecs(self.save_path)
        recs42 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=4)
        self.compare_recs(recs4, recs42)

        recs1 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=7)
        recs2 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=9)

        self.compare_recs(recs1, recs2)
    def test_rec_increasing(self):
        recommender = FunkSVDRecs(self.save_path)
        recs1 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=2)
        self.assertIsNotNone(recs1)
        self.assertEqual(len(recs1), 2)

        recs2 = recommender.recommend_items_by_ratings('5',
                                                       [{'movie_id': AVENGERS, 'rating': 1}], num=3)
        self.assertIsNotNone(recs2)
        self.assertEqual(len(recs2), 3)

        self.assertEqual(recs1[0],recs2[0] )
        self.assertEqual(recs1[1],recs2[1] )
    def test_rec_increasing(self):
        recommender = FunkSVDRecs(self.save_path)
        recs1 = recommender.recommend_items_by_ratings('5',
                                                      [{'movie_id': AVENGERS, 'rating': 1}], num=2)
        self.assertIsNotNone(recs1)
        self.assertEqual(len(recs1), 2)

        recs2 = recommender.recommend_items_by_ratings('5',
                                                       [{'movie_id': AVENGERS, 'rating': 1}], num=3)
        self.assertIsNotNone(recs2)
        self.assertEqual(len(recs2), 3)

        self.assertEqual(recs1[0],recs2[0] )
        self.assertEqual(recs1[1],recs2[1] )
 def test_rec2(self):
     recommender = FunkSVDRecs(self.save_path)
     recs = recommender.recommend_items_by_ratings('5',
                                                   [{'movie_id': AVENGERS, 'rating': 1}], num=5)
     self.assertIsNotNone(recs)
     self.assertEqual(len(recs), 5)
     top = [r[0] for r in recs][:2]
     self.assertIn(HARRY, top, '{} was missing from {}'.format(HARRY, top))
     self.assertIn(JACQUES, top, '{} was missing from {}'.format(JACQUES, top))
    def test_rec(self):

        recommender = FunkSVDRecs(self.save_path)
        recs = recommender.recommend_items_by_ratings('1',
                                                      [{'movie_id': AVENGERS, 'rating': 7},
                                                       {'movie_id': ALIEN, 'rating': 10},
                                                       {'movie_id': CAPTAIN_AMERICA, 'rating': 6}], num=2)
        self.assertIsNotNone(recs)
        self.assertEqual(len(recs), 2)
 def test_rec2(self):
     recommender = FunkSVDRecs(self.save_path)
     recs = recommender.recommend_items_by_ratings('5',
                                                   [{'movie_id': AVENGERS, 'rating': 1}], num=5)
     self.assertIsNotNone(recs)
     self.assertEqual(len(recs), 5)
     top = [r[0] for r in recs][:2]
     self.assertIn(HARRY, top, '{} was missing from {}'.format(HARRY, top))
     self.assertIn(JACQUES, top, '{} was missing from {}'.format(JACQUES, top))
    def test_rec(self):

        recommender = FunkSVDRecs(self.save_path)
        recs = recommender.recommend_items_by_ratings('1',
                                                      [{'movie_id': AVENGERS, 'rating': 7},
                                                       {'movie_id': ALIEN, 'rating': 10},
                                                       {'movie_id': CAPTAIN_AMERICA, 'rating': 6}], num=2)
        self.assertIsNotNone(recs)
        self.assertEqual(len(recs), 2)