I'm currently developing a showcase where I want this option order by rating. However, I'm not happy with the way most sites work. For example, think about having a 5 stars rating system, if I rate something 5 stars and I am the only one who has rated it, then it's already in the top 1! No that's not good, we need something to add more weight to items that have more votes.
Currently I'm doing a thumbs up and down system. And I am trying to figure out a good algorithm for this. I started playing with PHP, try running this:
Code: Select all
$values = array(array(5,3),array(5,0),array(10,5),array(15,13));
function get($valuesarray)
{
global $method;
$up = $valuesarray[0];
$down = $valuesarray[1];
return (($up-$down)*log($up+$down,3));;
}
foreach ($values as $array)
{
echo 'Up: '.$array[0].'<br />Down: '.$array[1].'<br />Order: '.number_format(get($array),2,'.',' ').'<br /><br />';
}Up 5, Down 0 has a great rate, but only 5 rates so it loses against 10/5.Up: 5
Down: 3
Order: 3.79
Up: 5
Down: 0
Order: 7.32
Up: 10
Down: 5
Order: 12.32
Up: 15
Down: 13
Order: 6.07
Are there any algorithms for these kind of situation where we are trying to make a realistic "order by rating" feature?
In 5-star rating system, It's obvious that something that has rate of 4.95 and 1000 votes should rank higher than rate of 4.96 with e.g. 600 votes.