$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); // 33的意义是什么?可能的最高评级是多少?
发布于 2011-07-12 00:25:25
您正在将此产品的评级与所有产品的评级进行比较,因此您的答案是评级。如果$avg_rating和$this_rating是3.7和4,那么你的答案是满分10。如果你的答案是满分5,那么你的答案是满分5。$bayesian_rating,$avg_rating和$this_rating都是可比较的。
发布于 2011-07-12 00:25:50
好吧,算出你的数学:
((18 * 3.7) + (6 * 4)) / (18 + 6)
(66.6 + 24) / (24)
90.6 / 24
3.775所以它是1分中的3分...
https://stackoverflow.com/questions/6653215
复制相似问题