Lesson 5: Collaborative Filtering using Embeddings

I am trying to perform prediction, after having run the Mini net model on the movie lens dataset. I am unable to determine which function to use for prediction. Also, in this case, how can we recommend a list of movies to a user. Since this is a tabular data, given a userId a movieId, the prediction would yield a rating for that movie so how can one perform a recommendation.

1 Like

To get a prediction for a numpy array called new_data with 2 columns (1st column for userId and 2nd column for movieId) for userId-movieId pairs that you’d like predictions for:

new_data = torch.from_numpy(new_data)
new_data = new_data.cuda()
new_data = new_data.long()
blankconts = blankconts.long()
prediction = model(new_data,blankconts)

We need blankconts because forward is expecting both cats and conts (although it doesn’t use conts).

Not sure I understand your other question… For a given user wouldn’t you just recommend the movies that have the highest rating predictions for that user?

1 Like