Need help with a like / dislike voting system

I would like some help to create a like / dislike sorting algorithm to find the best entries. I was thinking about how to do this, but there are two serious flaws in this method, and I would like to know if there is a better way.

Here's how I thought about it:

The entries will be sorted by the coefficient indicated by l/d , where l = number of likes and d = number of dislikes , so those with a higher coefficient will have more votes and deserve a higher place than those with low ratio.

There are two problems with this method:

1: if the hostility number is 0, l/d will be impossible. Thus, even if there are a thousand likes and 0 dislikes in the record, it still will not get on the scoreboard.

2: entries with a low number of likes and dislikes are an advantage over those with a lot of ratings, as it accepts a small number of ratings to influence the ratio and give a good rating.

What do you think?

EDIT : Here's a possible alternative that fixes the 1st issue: (l + 1) / (d + 1) . Any feedback on this?

+6
source share
3 answers

This may be relevant: How not to sort by average rating .

+13
source

To remove the division by zero, you can add 1 to the numerator and denominator to get (l + 1) / (d + 1). If you want to rank more entries with a large number of likes, then you can multiply your rating formula by the magazine (number of likes + 1). Here, one is added to remove the mathematical error that occurs if the record has a null value. For the subsequent discussion, suppose that the log has a base of 10. Thus, the ranking formula that meets the requirements will (like + 1) / (not like + 1) * log (like + 1).

Note that this formula gives a rank of 0 if there aren’t any, because log (1) = 0. Suppose that the votes are connected by one vote and one dislike vote. Then the rank is 2/2 * log (2) = 0.3, since log (2) = 0.3. Now consider another tie with 9 cute and 9 dislikes. Then the rank is 10/10 * log (10) = 1, since log (10) = 1. That is, a member of the journal (likes) estimates the connection with the prettier than the connection with a smaller number of cute.

+2
source

It worked better for me.

rank = likes * 100 / (likes + dislikes)

He orders higher morals, then any similar and / or unloved activity, and then no activity. examples:

 likes, dislikes => rank 0, 0 => 0 //avoid /0 error 3, 3 => 50 3, 0 => 100 
0
source

Source: https://habr.com/ru/post/892075/


All Articles