Reddit implements "best" comment sorting based on score confidence intervals.
blog.reddit.com
blog.reddit.com
* the reader wants some filtering, so they can just read the good stuff
* the filtering is done by the readers, which requires they read more than just the good stuff
How effective can this ever be? It seems a weakness in all public-contribution-based systems (including Google search to some extent, because of page-rank . . .).
(I posted this thought before somewhere, but I don't know if it wasn't thought good, or that no-one much read it.)
at least reddit has categories.
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".a) 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.
10 up 10 down 0.327403766068315
50 up 50 down 0.418847795168265
100 up 0 down 0.973657278603792
70 up 30 down 0.620167865061336
2 up 1 down 0.253533865071156
10 up 20 down 0.210836926288844
and a few more to see some other interesting cases...
100 up 30 down 0.703333001615963
10 up 3 down 0.541934244292211
30 up 100 down 0.175849385303401
1 up 0 down 0.269865944074627
1 up 1 down 0.120866317496523
2 up 0 down 0.425030603165412
100 up 0 down 0.973657278603792
100 up 100 down 0.442235043128361
200 up 0 down 0.986652839030471
as you can see. as there are more votes cast, the confidence that this represents the ultimate ranking improves. with less votes, a high up/down ratio is good, but not as good as a high up/down ratio with more total votes (because there is more statistical confidence with more data points).
finally below are the test cases that broke your initial implementation.
200 up 1800 down 0.0895005864992562
300 up 4200 down 0.0608069702294983
400 up 7600 down 0.0461419135745087
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 comment that sparked a lot of conversation (has a lot of children) should be a good candidate for floating towards the top as well.
You can game Hacker News currently this way. If there is already comments in a topic, don't start a new thread, instead reply to the top thread no matter what they said. You will get more replies and more votes.
just allow folks to score whatever/whoever they feel like, rather than foisting your version of 'goodness' on others. make low scoring articles fade into the background...
rank = (upvote-downvote)/some_time_dependent_stuff