I just had a look at http://www.reddit.com/user/Glorificus/comments/?sort=controversial and it seems to me that the algorithm used for sorting by controversy could use a little tweaking. For example, the top comment on that link is +15/-14 and the second is +102/-101, which I would consider more controversial. The eighth on the list is +65/-68, which IMHO should outrank all but the second one.
So here is my suggestion for improvement: when sorting by controversial, calculate a score for the item (comment or link) as the number of its votes minus the absolute of the net vote and sort by that. So +102/-101 gets the score 202 (102+101-abs(102-101) = 202), +15/-14 scores 28, and +65/-68 scores 130.
EDIT: I found the spot in the code, currently, it's
return float(ups + downs) / max(abs(score(ups, downs)), 1)
suggested change:
return float(ups + downs) - abs(score(ups, downs))
Hypothetically speaking, how would I go about submitting a patch?
EDIT 2: Here is a comparison of suggested approaches and resulting controversy scores:
| ups |
downs |
old |
mine |
min |
samsung |
robosatan |
| 100 |
100 |
200.000 |
200.000 |
100.000 |
1.000 |
14.142 |
| 1000 |
100 |
1.222 |
200.000 |
100.000 |
0.000 |
0.061 |
| 15 |
10 |
5.000 |
20.000 |
10.000 |
0.363 |
1.710 |
| 1015 |
1010 |
405.000 |
2020.000 |
1010.000 |
0.368 |
43.344 |
| 1000 |
1000 |
2000.000 |
2000.000 |
1000.000 |
1.000 |
44.721 |
| 102 |
101 |
203.000 |
202.000 |
101.000 |
0.819 |
13.525 |
| 65 |
68 |
44.333 |
130.000 |
65.000 |
0.549 |
9.295 |
| 15 |
14 |
29.000 |
28.000 |
14.000 |
0.819 |
4.302 |
| 1 |
0 |
1.000 |
0.000 |
0.000 |
0.000 |
1.000 |
| 100 |
1 |
1.020 |
2.000 |
1.000 |
0.000 |
0.104 |
| 1 |
100 |
1.020 |
2.000 |
1.000 |
0.000 |
0.104 |
| 1 |
1 |
2.000 |
2.000 |
1.000 |
1.000 |
1.414 |
| 150 |
151 |
301.000 |
300.000 |
150.000 |
0.819 |
16.706 |
| 100 |
90 |
19.000 |
180.000 |
90.000 |
0.135 |
8.156 |
| 1000 |
1010 |
201.000 |
2000.000 |
1000.000 |
0.135 |
41.581 |
I used 0.1 and 0.5 as constants for samsung's and robosatan's algorithms respectively. I also modified robosatan's algorithm by dividing 1 by his score and safeguarding against the case when both ups and downs are 0, which made it IMHO the winner:
1/(max(ups + downs, 1)^(alpha - min(ups, downs)/max(ups, downs, 1)))
samsung's algorithm, independent of the constant's value does not distinguish between +100/-100 and +1/-1 or any two items where the difference between ups and downs is identical.
[–]raldi[A] 5 points6 points7 points ago
[–]sunkid[S] 2 points3 points4 points ago
[–]raldi 2 points3 points4 points ago*
[–]sunkid[S] 2 points3 points4 points ago
[–]robosatan 5 points6 points7 points ago*
[–][deleted] 4 points5 points6 points ago*
[–]robosatan 0 points1 point2 points ago
[–]sunkid[S] 0 points1 point2 points ago
[–]raldi 0 points1 point2 points ago
[–]sunkid[S] 0 points1 point2 points ago
[–]sunkid[S] 0 points1 point2 points ago
[–][deleted] 1 point2 points3 points ago
[–]phire14 1 point2 points3 points ago
[–]joelthelion 0 points1 point2 points ago
[–]MercurialMadnessMan 1 point2 points3 points ago
[–]sunkid[S] 0 points1 point2 points ago
[–]fazon 0 points1 point2 points ago
[–]raldi 1 point2 points3 points ago
[–]fazon 0 points1 point2 points ago
[–]raldi 1 point2 points3 points ago
[–]fazon -1 points0 points1 point ago
[–]fazon -4 points-3 points-2 points ago
[–]DEADB33F 0 points1 point2 points ago
[–]sunkid[S] 0 points1 point2 points ago
[–]mariod505 -5 points-4 points-3 points ago