Generating movie recommendations

Now that we built all of the different parts of a recommendation engine, we are ready to generate movie recommendations. We will use all the functionality that we built in the previous recipes to build a movie recommendation engine. Let's see how to build it.

How to do it…

  1. Create a new Python file, and import the following packages:
    import json
    import numpy as np
    
    from euclidean_score import euclidean_score
    from pearson_score import pearson_score
    from find_similar_users import find_similar_users
  2. We will define a function to generate movie recommendations for a given user. The first step is to check whether the user exists in the dataset:
    # Generate recommendations for a given user def generate_recommendations(dataset, ...

Get Python Machine Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.