【发布时间】:2015-02-14 02:33:28
【问题描述】:
来自这个question的关于累积平均值。
答案看起来不错。但是,如果用户可以编辑评级,我正在尝试查找是否可以使用相同的方法。我试图知道接受答案的用户的想法,但他没有回复。所以我正在创建一个新问题。
每次获得新评分时,更新累积平均值并 评分计数:
new_count = old_count + 1
new_average = ((old_average * old_count) + new_rating) / new_count
如果用户可以编辑评分:
new_count = old_count // With a rating edit, the count will be the same
new_average = ?
【问题讨论】:
标签: sql algorithm math logic rating