Jump to content

Voting system flaw


newbtophp

Recommended Posts

Hey!,

 

Just looking for some advice on developing a voting/rating algorithm.

 

What is the most effective way to develop this?

 

Right now, I am using minimalistic/very simple algorithm, I have two columns: number_of_votes and total_vote, and the score = number_of_votes/total_vote

 

Problem is, it can be easily skewed if their are a low number of votes (1 vote of 5 will boost the score to 5).

 

PS: They can vote from 1-5 (the max the score can be is 5)

 

Thanks guys!

Link to comment
Share on other sites

I don't see anything wrong with your current method. That is generally how all star voting systems work. People vote 1-5 and you display the average of those votes. So what if the first vote is 5 and that boosts it to 5 automatically? That's why you also display the number of votes so people don't get the wrong idea.

Link to comment
Share on other sites

I don't see anything wrong with your current method. That is generally how all star voting systems work. People vote 1-5 and you display the average of those votes. So what if the first vote is 5 and that boosts it to 5 automatically? That's why you also display the number of votes so people don't get the wrong idea.

 

Well I know but say if theirs 1 vote of 5, the score will = 5 (however thats 1 voters opinion which can effect the importance or quality of the content), and if for example I display a 'Top X' based upon their score, they can jump to the list.

 

I googled around and found the following:

 

http://www.thebroth.com/blog/118/bayesian-rating

 

But seems abit too mathematical for me to integrate, so was hoping someone could help me.

 

 

EDIT: added a better example

Link to comment
Share on other sites

Well, then what you're looking for isn't another way to handle star ratings (In fact, any other way would be pretty misleading). Instead, you're looking for a way to rank different entries overall. One such way, as you mentioned in the Bayesian rating system, of which the average star rating is one factor.

 

Here's an example MySQL implementation of the weighted Bayesian rating system using your current setup:

 

SELECT * FROM table ORDER BY (number_of_votes / (number_of_votes + 0) * (total_vote / number_of_votes) + (0 / (number_of_votes + 0)) * (SELECT AVG(total_vote / number_of_votes) FROM table) DESC LIMIT 10

 

That should work, but with your current setup I can't think of any way to do it without a subquery. If your database structure was nicer it would be easier. Note that if you want to require a minimum number of votes for it to be selected in the query (and displayed on the top X rated) you'll need to change the 0s in that query to whatever requirement you want.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.