-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PPR for Bipartite graph in recommendation #25
Comments
Hi @riyaj8888 , I am not very familiar with the latest research on recommender systems, so you might want to take a look at that first. One particular question would be whether you need to pre-process your data to account for the sparsity of user-item interactions (e.g., cluster users or items into groups, and then operate on a densified user-cluster-item-cluster interaction matrix). That said, this library only gives you a (fast) way to compute the (personalized) page rank, which can be interpreted as a relevance score. A quick application I can think of is to calculate PPR scores for a given user, and then recommend items that have a high score. To do this, you need to
import torch
edge_index = torch.as_tensor(data=[
(user_id, item_id + num_users)
for user_id, item_id in user_item_interactions
]).t() Note that you have to make sure that the node IDs are unique, i.e., a user with id
from torch_ppr import personalized_page_rank
scores = personalized_page_rank(edge_index=edge_index, indices=[user_id_of_interest]) Note that this will be a vector of size
best_item_ids = scores[num_users:].topk(k=10, sorted=True) |
Thanks, |
No. With the code above, you use the node ids You could also switch that, but then you would need to adjust step 2, too, since |
can u provide one simple example , how to use it for bipartite graph for recommending items to for users using this PPR code.
thanks
The text was updated successfully, but these errors were encountered: