Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rank / Reputation Algorithm

Tags:

algorithm

I am writing an e-commerce engine that has a reputation component. I'd like users to be able to review and rate the items, and be able to rate the review.

What is the best algorithm to use to sort items based on "best" reviews? It has to be ranked by the amount of quality reviews it gets by the people who give the best reviews. I'm not sure how to translate this to algorithm.

For instance, I need to be able to compare between an item that has 5 stars from many people with low reputation, against another item that has 3 stars from a few people with high reputation.

To add to the complexity, some users may have written many reviews that are rate high / low by others, and other users may have written few reviews, but rated very high by other users. Which user is more reputable in this case?

like image 551
Jonas Arcangel Avatar asked Dec 01 '11 18:12

Jonas Arcangel


1 Answers

If you know the reputations of the users, then you might use a UserScore for each user such as the one that Stackexchange uses.

UserScore = Reputation >= 200 ? 0.233 * ln(Reputation-101) - 0.75 : 0 + 1.5

Then you find the value of an item by summing up the user scores with the stars as weights:

ItemScore = \sum_i UserScore_i * Weight[Star_i]

where i is the index for the votes and Weight is the array involving the weights of stars. For example, it can be [-2 -1 0 1 2] for a voting system of 5 stars. And one note is that you may change the weight of the 3 stars to be +eps if you want the items with only 3 stars to come before the items which are not evaluated.

You may change 200 and all other constants/weights accordingly to your needs.

like image 112
petrichor Avatar answered Oct 23 '22 05:10

petrichor