how can i generate a recommended list of movies for a user? knowing that I use a multilayer perceptron to predict the missing ratings, ( the net is already trained ) my model is :
net = EmbeddingNet(
n_users=n, n_movies=m,
n_factors=15, hidden=[150, 100], dropouts=[0.2, 0.2])
the best weights after training :
net.load_state_dict(best_weights)
the embddings users and the embeddings movies after training :
embedu = to_numpy(net.u.weight.data)
embedm = to_numpy(net.m.weight.data)
so my questions are :
do I have to multiply the embeddings vectors of the users by the embeddings vectors of the films to form a user-film matrix?
pred = np.dot(embedu, embedm.transpose())
Or do I have to take the net model prediction directly? but the number ratings predicted here is less than the number of (users number X movies number)
pred = net(usersId, moviesId)
pred = pred.detach().numpy().tolist()
Or is there another solution for the prediction? because I tried to follow this tutorial of fastai to realize a system of collaborative filtering ... but they do not give how by examples to generate to a user the list of the recommended films
here is the link : https://github.com/fastai/fastai/blob/master/courses/dl1/lesson5-movielens.ipynb and thank you
The following code multiplies each user and item embedding, then argsorts it to return indices of movies in descending ratings i.e. the order in which you would recommend if you want to recommend the highest rated movie first.
(-embedu.dot(embedm.T)).argsort()