r/programming • • Dec 09 '13

Reddit’s empire is founded on a flawed algorithm

http://technotes.iangreenleaf.com/posts/2013-12-09-reddits-empire-is-built-on-a-flawed-algorithm.html
2.9k Upvotes

503 comments sorted by

View all comments

Show parent comment

13

u/[deleted] Dec 10 '13
SORT MIN(ups, downs) DESCENDING

doesn't account for that, though. Not in any intelligent way, at least. By that algorithm, 1000 up, 100 down is just as controversial as 100 up, 100 down. Yeah you're more confident about the controversy score for the first one, but you're confident that it is less controversial than the second. If you had to guess, would you give even odds that the next 1000 votes are all up for the second post?

8

u/scapermoya Dec 10 '13 edited Dec 10 '13

my code does account for that though.

1000 up, 100 down gives a score of 0.81

100 up, 100 down gives a score of 0

100 up, 90 down gives a score of 0.053

100 up 50 down gives a score of 0.33

100 up, 10 down gives a score of 0.81

the obvious problem with my code is that it treats equal ratios of votes as true equals without accounting for total votes. one could add a correction factor that would probably have to be small (to not kill young posts) and determined empirically to adjust for the dynamics of a given subreddit.

edit: an alternative would be doing a chi squared test on the votes and ranking by descending P value. you'd still have to figure out a way to intersperse the ties (p-value would equal 1), but you'd at least be rewarding the high voted posts.

1

u/rabbitlion Dec 10 '13

Maybe you could simply multiply your score with the log10 of the vote total or something like that. Perhaps not perfect but at least fairly simple (which is always a virtue) and reasonably effective.