Пример #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_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))
Пример #3
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))
Пример #4
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()))