3
$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的意义是什么?可能的最高评分是多少?

4

2 回答 2

1

您正在将此产品的评分与所有产品的评分进行比较,因此您的答案是评分。如果 $avg_rating 和 $this_rating 分别为 3.7 和 4 分(满分 10 分),那么您的答案是满分 10 分。如果它是满分 5 分,那么您的答案是满分 5 分。$bayesian_rating、$avg_rating 和 $this_rating 都具有可比性。

于 2011-07-11T16:25:25.423 回答
1

好吧,计算你的数学:

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

所以1分之3...

于 2011-07-11T16:25:50.100 回答