Bayesian Rating

旧时模样 提交于 2019-12-05 02:33:15

问题


$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

What is the significance of 3? What is the highest possible rating?


回答1:


you're comparing the ratings for this product against the ratings in all products, so your answer is a rating. If $avg_rating and $this_rating are 3.7 and 4 out of 10, then your answer is out of 10. If it's out of 5, then your answer is out of 5. $bayesian_rating, $avg_rating, and $this_rating are all comparable.




回答2:


Well, working out your math:

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

So it's 3 out of 1...



来源:https://stackoverflow.com/questions/6653215/bayesian-rating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!