Topic: counting votes/ratings - a new (?) more fair (?) way to do it!
What bothers me, is that when you simply average votes or ratings, one or two party poopers can pull down a product's score from five stars to four, even though by far the majority of voters may think that the product is worthy of 5 stars.
I tried a "weighted average" algorithm, such as is used on most sites, for example on IMDB.com. But it doesn't do what I want. So I came up with this:
$votes = array(
1 => 1,
2 => 1,
3 => 0,
4 => 10,
5 => 20
);
$weight = 0;
$numvotes = 0;
foreach ($votes as $vote => $count) {
$weight += $count*$count;
$numvotes += $count;
echo "$count people voted $vote<br />";
}
echo "total vote weighs $weight<br />";
$score = 0;
$avg = 0;
foreach ($votes as $vote => $count) {
$score += $vote * ($count*$count / $weight);
$avg += $vote * ($count / $numvotes);
}
echo "average is: $avg<br />";
echo "weighted score is: $score<br />";
The output of this little script is as follows:
1 people voted 1
1 people voted 2
0 people voted 3
10 people voted 4
20 people voted 5
total vote weighs 502
average is: 4.46875
weighted score is: 4.7868525896414
As you can see, the way that I calculate my weighted score, the two party poopers who voted this product 1 and 2 are nearly discredited. I also display the plain average for comparison - as you can see, in a plain average, this product would be ranked down to 4 stars. By far the majority of voters thought this product should be a 4 or 5 star product - the way I calculate it, the majority rules.
What do you think of this sort of averaging? Is it fair? Does it make sense?
(note, I'm using a power of two for the weight - I've tried other powers; a power of 1.5 seems to not tilt the scores enough, while a power of 3 or higher seems to cancel out the effects of any negative votes altogether, which is also not fair ... power of 2 seems to work best.)