Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need help on like/dislike voting system

I'd like to get some help to build a like/dislike sorting algorithm to find the best entries. I thought about a way to do it, but there are two major flaws with this method and I'd like to know if there's any better way.

Here's how I thought about doing it:

The entries would be sorted by the ratio given by l/d where l = number of likes and d = number of dislikes, so that those with a higher ratio have a bigger likes count and deserve a higher up place than those with a low ratio.

There are two issues with this method:

1: if the number of dislikes is 0 the l/d will be impossible. So even if an entry has a thousand of likes and 0 dislikes it still won't get any place into the scoreboard.

2: entries with a low amount of likes and dislikes are at an advantage in comparison with those with many ratings since it takes a low amount of ratings to influence the ratio and give the entry a good score.

What do you think?

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

like image 318
Gabriele Cirulli Avatar asked Jul 05 '11 21:07

Gabriele Cirulli


People also ask

Why do some voting methods require new software?

Some voting methods require new software that election administrators don’t have. And even if the machine’s software supports a voting method, it may still require added complexities such as counting every ballot at one central location. So, how do alternative voting methods stack up against these criteria?

What are the best alternative voting methods?

Studied since the 1970s and often cited as one of the best alternative voting methods, approval voting simply asks voters to select all the candidates they approve of and the candidate with the most votes wins. It’s been shown to easily elect a “good” candidate and encourage competition.

What are the advantages of other voting methods?

Other voting methods allow voters to honestly vote for the candidates they like without fearing they’ll be a spoiler. They can even help candidates really see how much support they have from the electorate, even if they don’t win.

Should I keep the Like/Dislike button on my website?

There will be a lot of spam if you open the like/dislike system to the public. So yes, I will recommend keeping like/dislike as a “users only feature”. If you do not want to build a user system, you really should be looking at the Facebook Like Button for web pages.


2 Answers

This might be relevant: How Not To Sort By Average Rating.

like image 166
mhum Avatar answered Nov 15 '22 07:11

mhum


To remove the division by zero, you might add 1 to the numerator and denominator to obtain (l+1)/(d+1). If you want to more highly rank entries with more likes, then you might multiply your ranking formula by log(number of likes + 1). Here the one is added to remove the mathematical error that results if the entry has zero likes. For the discussion that follows, assume that the log has a base of 10. So a ranking formula that meets the requirements would be (likes + 1)/(dislikes + 1) * log(likes + 1).

Observe that this formula provides a rank of 0 if there are no likes because log(1) = 0. Suppose that the votes are tied with one like vote and one dislike vote. Then the rank is 2/2*log(2) = 0.3 because log(2) = 0.3. Now consider another tie with 9 likes and 9 dislikes. Then the rank is 10/10*log(10) = 1, because log(10) = 1. That is, the log(likes) term ranks ties with more likes more highly than ties with fewer likes.

like image 23
Seth Difley Avatar answered Nov 15 '22 08:11

Seth Difley