Algorithm for scoring user activity

Posted by ManBugra on Stack Overflow See other posts from Stack Overflow or by ManBugra
Published on 2010-05-07T21:41:31Z Indexed on 2010/05/07 21:48 UTC
Read the original article Hit count: 282

I have an application where users can:

  1. Write reviews about products
  2. Add comments to products
  3. Up / Down vote reviews
  4. Up / Down vote comments

Every Up/Down vote is recorded in a db table.

What i want to do now is to create a ranking of the most active users in the last 4 weeks. Of course good reviews should be weighted more than good comments. But also e.g. 10 good comments should be weighted more than just one good review.

Example:

// 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";

How would a fair scoring function look like? How could an implementation of the score() function look like? How to add a weight g to the function so that reviews are weighted heavier? How would such a function look like if, for example, votes for pictures would be added?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about scoring