anzhang314 / BC-Loss

Official code of "Incorporating Bias-aware Margins into Contrastive Loss for Collaborative Filtering" (2022 NeurIPS)
MIT License
22 stars 2 forks source link

A little question about ratings_diag in BCLoss_Batch #2

Closed LeavesLi1015 closed 1 year ago

LeavesLi1015 commented 1 year ago

Hello, I'm currently working on graph contrastive learning and I really appreciate your work! However, I get a bit confused by the ratings_diag in BCLoss function. It's ratings_diag = torch.cos(torch.arccos(torch.clamp(ratings_diag,-1+1e-7,1-1e-7))+(1-torch.sigmoid(pos_ratings_margin))) and pos_ratings = torch.cos(torch.arccos(torch.clamp(pos_ratings,-1+1e-7,1-1e-7))+(1-torch.sigmoid(pos_ratings_margin))) that confuses me. I can't associate M_{ui} in the equation(6) with 1-sigmoid(pos_ratings_margin). Could you provide an explaination? Thanks a lot!

Best, Lucas

image

Arthurma71 commented 1 year ago

Our implementation here is indeed a little bit different from the paper, which is equivalent to M = 1-sigmoid(| u || i |cos(bias)). It it a modified version of BCLoss we implemented for better performance where the imposed angular margin is still positively correlated w.r.t popularity bias(The key of BCLoss), but also taking the norm of user/item popularity representation into account as indicator of confidence of bias factor.