贝叶斯评级

时间:2011-07-11 16:18:54

标签: php rating bayesian

$avg_num_votes = 18; // Average number of votes in all products
 $avg_rating = 3.7; // Average rating for all products
$this_num_votes = 6; // Number of votes for this product
 $this_rating = 4; // Rating for this product


$bayesian_rating = ( ($avg_num_votes * $avg_rating) + ($this_num_votes * $this_rating) ) /    ($avg_num_votes + $this_num_votes);

echo round($bayesian_rating); // 3

3的意义是什么?什么是最高评级?

2 个答案:

答案 0 :(得分:1)

您将此产品的评分与所有产品的评分进行比较,因此您的答案是评分。如果$ avg_rating和$ this_rating是3.7和4中的4,那么你的答案是10个。如果它超过5,那么你的答案是5个。$ bayesian_rating,$ avg_rating和$ this_rating都是可比较的。< / p>

答案 1 :(得分:1)

好吧,算你的数学:

((18 * 3.7) + (6 * 4)) / (18 + 6)
(66.6 + 24) / (24)
90.6 / 24
3.775

所以它是1中的3个......