ankane / cmfrec-ruby

Recommendations for Ruby using collective matrix factorization
MIT License
29 stars 2 forks source link

Tweak calculation of similarity for simiilar users to "boost" some attributes #5

Closed vitobotta closed 1 year ago

vitobotta commented 1 year ago

Hi, I am using this gem to determine the most similar users to a target user.

I understand that I can use the side information to rank for example similar users with the same location as the target user higher; however I would also like to "boost" similar users who have a higher number of ratings by value.

So for example if user A has 3 ratings with 5 as the value, they should rank higher than user B with only 1 rating with 5 and so on. Explanation: I find similar users by shared interests (so the items in this case are the interests) with implicit feedback since users only select interests but don't rate them like with movies or products; instead, I assign a different value as implicit feedback: for example if the target user has an interest to investing in X, both the target user and users with the opposite intent (looking for investment in X) get a value of 5 for the same interest, while other interests get a lower value.

Now I would like to give a boost according to the number of these 5-values so that users with more opposite intents rank higher. So if user A shares two interests with opposite intent compared to the target user, they should rank higher than someone with only one opposite intent. I got this working while experimenting with just the original user-item matrix and a custom method to calculate the cosine similarity, but I would like to still use cmfrec since it's a much more complete solution.

So is it possible to somehow tweak how cosine similarity is calculated in cmfrec to determine similar users? Thanks in advance

vitobotta commented 1 year ago

I think I found how to do it from looking at the code better. Thanks