awarebayes / RecNN

Reinforced Recommendation toolkit built around pytorch 1.7
Apache License 2.0
574 stars 113 forks source link

Show the user recommendation #26

Open AMG222 opened 2 years ago

AMG222 commented 2 years ago

I read your work, becosuse i want to create a RS using RL. I was interested in how i can print the user id of each recomendation obtanied?

from scipy.spatial import distance
import json
import pandas as pd
value_net  = recnn.nn.Critic(1290, 128, 256, 54e-2)
policy_net = recnn.nn.Actor(1290, 128, 256, 6e-1)
meta = json.load(open('omdb.json'))
recommendation = policy_net(state)
x = np.random.randint(0, state.size(0), 1)
recommendation = recommendation[x[0]].detach().cpu().numpy()
rank(recommendation, distance.euclidean)

I guess that the x is the index of the recommendation of a user having 1731 recommendations of 128 movies, but to know how good is the recommendation i want to know the user ID of each recommendation. Thanks