예제 #1
0
def main():
    aggregated_recommendations = aggregate_recommendations(verbose=False)

    stats = count_occurrences(aggregated_recommendations,
                              verbose=False)

    app_ids, pb_occurrences_dict, rb_occurrences_dict = summarize_occurrences(aggregated_recommendations,
                                                                              stats,
                                                                              chosen_num_occurrences=max(stats.keys()),
                                                                              verbose=True)

    for app_id in app_ids:
        data = extract_data_with_equal_release_recency_bias(app_id,
                                                            aggregated_recommendations,
                                                            rb_occurrences_dict,
                                                            verbose=True)
        data = extract_data_with_equal_popularity_bias(app_id,
                                                       aggregated_recommendations,
                                                       pb_occurrences_dict,
                                                       verbose=True)
        data = extract_data(app_id,
                            aggregated_recommendations,
                            verbose=True)

    return
예제 #2
0
    def test_get_total_num_apps(self):
        aggregated_recommendations = inverse_problem.aggregate_recommendations(
            verbose=True)
        stats = inverse_problem.count_occurrences(aggregated_recommendations,
                                                  verbose=True)
        total_num_apps = inverse_problem.get_total_num_apps(stats,
                                                            verbose=True)

        expected_total_num_apps = len(aggregated_recommendations)

        self.assertEqual(total_num_apps, expected_total_num_apps)
예제 #3
0
    def test_get_total_num_occurrences(self):
        aggregated_recommendations = inverse_problem.aggregate_recommendations(
            verbose=True)
        stats = inverse_problem.count_occurrences(aggregated_recommendations,
                                                  verbose=True)
        total_num_occurrences = inverse_problem.get_total_num_occurrences(
            stats, verbose=True)

        num_rankings, ranking_size = inverse_problem.count_rankings(
            verbose=True)
        expected_total_num_occurrences = num_rankings * ranking_size

        self.assertEqual(total_num_occurrences, expected_total_num_occurrences)
예제 #4
0
    def test_extract_data(self):
        aggregated_recommendations = inverse_problem.aggregate_recommendations(
            verbose=False)

        app_ids, pb_occurrences_dict, rb_occurrences_dict = inverse_problem.summarize_occurrences(
            aggregated_recommendations, verbose=False)

        for app_id in app_ids:
            data = extract_regression_data.extract_data(
                app_id, aggregated_recommendations, verbose=True)

            X = data['X']
            y = data['y']
            self.assertEqual(len(X), len(y))
예제 #5
0
    def test_extract_data_with_equal_popularity_bias(self):
        aggregated_recommendations = inverse_problem.aggregate_recommendations(
            verbose=False)

        app_ids, pb_occurrences_dict, rb_occurrences_dict = inverse_problem.summarize_occurrences(
            aggregated_recommendations, verbose=False)

        for app_id in app_ids:
            data = extract_regression_data.extract_data_with_equal_popularity_bias(
                app_id,
                aggregated_recommendations,
                pb_occurrences_dict,
                verbose=True)
            for pb_argmax in data:
                X = data[pb_argmax]['X']
                y = data[pb_argmax]['y']
                self.assertEqual(len(X), len(y))
예제 #6
0
    def test_summarize_occurrences(self):
        aggregated_recommendations = inverse_problem.aggregate_recommendations(
            verbose=True)
        app_ids, pb_occurrences_dict, rb_occurrences_dict = inverse_problem.summarize_occurrences(
            aggregated_recommendations, verbose=True)

        self.assertGreater(len(app_ids), 0)
        self.assertEqual(len(app_ids), len(pb_occurrences_dict))
        self.assertEqual(len(app_ids), len(rb_occurrences_dict))

        pb_val = inverse_problem.get_popularity_bias_range()
        rb_val = inverse_problem.get_release_recency_bias_range()

        self.assertTrue(
            all(
                len(occurrences) == len(pb_val)
                for occurrences in pb_occurrences_dict.values()))
        self.assertTrue(
            all(
                len(occurrences) == len(rb_val)
                for occurrences in rb_occurrences_dict.values()))
예제 #7
0
 def test_count_occurrences(self):
     aggregated_recommendations = inverse_problem.aggregate_recommendations(
         verbose=True)
     stats = inverse_problem.count_occurrences(aggregated_recommendations,
                                               verbose=True)
     self.assertGreater(len(stats), 0)
예제 #8
0
 def test_aggregate_recommendations(self):
     aggregated_recommendations = inverse_problem.aggregate_recommendations(
         verbose=True)
     self.assertGreater(len(aggregated_recommendations), 0)