-
Notifications
You must be signed in to change notification settings - Fork 620
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
Add RP3Beta #634
base: 0.2.x
Are you sure you want to change the base?
Add RP3Beta #634
Conversation
specific_user_transitions = self.user_transition[user] | ||
|
||
# make all item predictions for specified users | ||
user_all_items = specific_user_transitions @ self.item_transition @ self.user_transition @ self.item_degree_inv.power( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the whole user_all_items matrix can be computed in advance to avoid multiplication in each batch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linzihan-backforward Hello, sorry for the (very) late reply. I intentionally avoided computing the entire user_item matrix to save memory. I included the all-at-once implementation at the top for reference, and explained the former. See
RecBole/recbole/model/general_recommender/rp3beta.py
Lines 28 to 43 in e28e150
# for reference, doing it in one computation | |
# since the resultant matrix is dense, I'll refrain from doing this | |
def calculate_rp3beta(B, beta): | |
user_degree_inv = get_inv_degree_matrix(B) | |
item_degree_inv = get_inv_degree_matrix(B.T) | |
# multiplication on left for row-wise scaling | |
user_transition = user_degree_inv @ B | |
item_transition = item_degree_inv @ B.T | |
P3 = user_transition @ item_transition @ user_transition | |
# multiplication on right for column-wise scaling (i.e., we're reweighting by inverse item popularity to a power) | |
RP3Beta = P3 @ item_degree_inv.power(beta) | |
return RP3Beta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It make sense. We will test the algorithm as soon as possible. It will be merged into the future version if everything is OK. Thanks again for your contribution !
|
||
specific_user_transitions = self.user_transition[user] | ||
|
||
item_predictions = specific_user_transitions @ self.item_transition @ self.user_transition @ self.item_degree_inv.power( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Random walk method from Updatable, Accurate, Diverse, and Scalable Recommendations for Interactive Applications https://dl.acm.org/doi/10.1145/2955101