views:

72

answers:

1

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?

+1  A: 

These kinds of algorithms can be quite complex. You might want to take a look into these books:

Kdeveloper
i have the books from Satnam and Oreilly. But they are dealing mostly with the creation of a similarity functions and further with classification and clustering. I want to do smth different: calculating a score. That's a different problem.
ManBugra