Exemplo n.º 1
0
def main():
    try:
        client = MongoClient('localhost', 27017)
        DataService.init(client)

        user_download_history = DataService.retrieve_user_download_history()
        all_app_id = DataService.get_all_app_id()

        for one_id in all_app_id:
            calculate_top_k(one_id, user_download_history.values(), 5)
        
        recommendations = DataService.retrieve_recommended_items()
        generate_recommendations(user_download_history, recommendations)

    except Exception as e:
        print(e)
    finally:
        if 'client' in locals():
            client.close()