From the course: Machine Learning and AI Foundations: Recommendations

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Find similar products

Find similar products

- [Instructor] In the previous video, we created these four data files. If you like to create them now, run train_recommender_cold_start final.py before you continue. Now let's open up product_similarity_from_data_files.py. When you show related products in the real application, you don't want to have refactor the matrix each time because it's too slow. Instead, you can use the product_features.dat file to calculate product similarity quickly. First we'll load the product_features.dat file using Python's pickle.load function. The M matrix that we just loaded has one column for each movie. Let's transpose the matrix so each column becomes a row. This just makes the data easier to work with, but it doesn't change the data. Next, we'll load the movie list using read_csv so we'll have access to the movie titles. And we'll pick a movie to find similar movies to. I've chosen movie_id = 5. Next we'll look up this movie in the movies_df dataframe and then we'll print out the movie's title and…

Contents