by antirez · 17y ago · 0 comments
score = upvotes*(upvotes/(upvotes+downvotes))
Edit: some example output follows. 10 up, 10 down = 5.0
50 up, 50 down = 25.0
100 up, 0 down = 100.0
70 up, 30 down = 49.0
2 up, 1 down = 1.3333
10 up, 20 down = 3.3333
This removes some bias due to the time, but does not remove from the game the idea that a lot of votes are still an hint of interest. Ah, and the math is trivial ;)Note that this is just the vanilla formula, you can simply alter the weight of the different parameters changing a bit the math.
Useless to say that this is only the first step to get the actual sorting. You may not want to order by score, but by rank, where rank is something like that (if the items you are sorting must be fresh):
rank = score / time^alpha
alpha is the "obsolescence factor". up down score
100 100 50
20 0 20
100 200 33
100 300 25
100 400 20
Wouldn't you want a comment with 20 upvotes and no downvotes to rank above a comment with 100 upvotes and 300 downvotes? It gets even worse for higher numbers: up down score
200 1800 20
300 4200 20
400 7600 20a) time matters, so good old comments tend to go down, but this only happens in the first 24/48 hours, in the long run everything is much more ordered by score. b) the score of a comment is roughly up/down but it tends to get better with more votes. c) still much better a/b ratios tend to win against other comments having a lot of comments. For instance a 100 up and 50 down will win against a 10 up and 5 down in a strong way, but will be more or less the same score as a 15 up and 5 down.
I'll post here my final algorithm.