我有一个应用程序,用户可以:
撰写有关产品的评论
向产品添加评论
上/下投票审核
上/下投票评论
每次上下投票都记录在DB表中。
我现在要做的是创建一个最近4周最活跃用户的排名。
当然,好的评论应该比好的评论更重要。但是,10个好的评价应该比一个好的评价更重要。
例子:

// reviews created in recent 4 weeks
//format: [ upVoteCount, downVoteCount ]
var reviews = [ [120,23], [32,12], [12,0], [23,45] ];

// comments created in recent 4 weeks
// format: [ upVoteCount, downVoteCount ]
var comments = [ [1,2], [322,1], [0,0], [0,45] ];

// create weight vector
// format: [ reviewWeight, commentsWeight ]
var weight = [0.60, 0.40];

// signature: activties..., activityWeight
var userActivityScore = score(reviews, comments, weight);
... update user table ...

List<Users> users = "from users u order by u.userActivityScore desc";

公平的评分函数是什么样子的?
score()函数的实现看起来如何如何在函数中添加权重g,以便使评论更重?例如,如果添加了对图片的投票,这样的函数会是什么样子?

最佳答案

这类算法可能相当复杂。你可能想看看这些书:
Collective Intelligence in Action,Satnam Alag,曼宁,2008,ISBN 1933988312
Algorithms of the Intelligent Web,Haralambos Marmanis,曼宁2009,ISBN 1933988665
Programming Collective Intelligence: Building Smart Web 2.0 Applications,Toby Segaran,O'Reilly Media 2007,ISBN 0596529325

关于algorithm - 评分用户事件的算法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2791837/

10-17 01:32