Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weighted Voting Algorithm/Calculation

Tags:

ranking

I am creating a 'duel' app and I am at a dead-end to calculating the results.

Each user either has an upvote or downvote. There is no 1-5 or five-star rating.

For example: If I were displayed 5 times and won 3, I would have 3 'upvotes' and 2 'downvotes'.

If I did straight percentages, any who was displayed 1 time and selected 1 time (100%) would always be the top where as if someone was 9/10 (90%) they would be below the 1/1 but in theory would belong on top.

Anyone have any ideas of how to accomplish this?

like image 500
ehftwelve Avatar asked May 22 '26 18:05

ehftwelve


2 Answers

I, too, have been looking for a suitable algorithm for a voting website.

Whilst what @joshhendo suggested would appear to be a sound method of ranking votes, it doesn't take into account the percentage of positive votes.

For example:

  • Item 1 has 70 'up' votes and 30 'down' votes.
  • Item 2 has 400 'up' votes and 300 'down' votes.

For Item 1: 70-30 = 40
For Item 2: 400-300 = 100

Item 2 will appear above Item 1 because it has more positive votes. But Item 2 only has 25% positive votes, whereas Item 1 has ~57% positive votes. Item 1 should obviously appear above Item 2, because even though it doesn't have as many overall votes, it has a better 'up' to 'down' ratio of votes.

But then again, one wants to avoid the initial problem of items with 1 vote (positive) appearing above everything else.

I recommend you read this: http://www.evanmiller.org/how-not-to-sort-by-average-rating.html

It suggests a more mathematically sound solution to this problem. It's actually a very interesting read, and I will be implementing something similar into my own website.

[edit]
This is also a very good read: http://blog.linkibol.com/2010/05/07/how-to-build-a-popularity-algorithm-you-can-be-proud-of/
[/edit]

like image 135
Ollie Treend Avatar answered May 26 '26 14:05

Ollie Treend


Rather than the positive vote percent, track a bayesian average of that, e.g.:

(positive votes + weighted avg positive votes) / (total votes + arbitrary sample)

http://en.wikipedia.org/wiki/Bayesian_average

like image 24
Denis de Bernardy Avatar answered May 26 '26 14:05

Denis de Bernardy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!