Collaborative Filtering using Pytorch

I am trying to create a Netflix-like recommendation system using the movielens dataset. I have trained a model with the following definition:

class RecSysModel(nn.Module):
    def __init__(self, n_users, n_movies, n_factors=50):
        super(RecSysModel, self).__init__()
        self.user_factors = nn.Embedding(n_users, n_factors)
        self.movie_factors = nn.Embedding(n_movies, n_factors)
        self.output = nn.Linear(n_factors*2, 1) # n_factors = 100, 1
    def forward(self, user_id, movie_id):
        user_factors = self.user_factors(user_id)
        movie_factors = self.movie_factors(movie_id)
        out =[user_factors, movie_factors], dim=1)
        out = self.output(out)
        return out

Now I want to use it in production for new users that are not in the dataset, so how should I take in a list of movies a new user has liked and recommend movies based on that?

@ptrblck Any suggestions on this topic?

Sorry, but I don’t know which approach would work for your use case.

No problem :).