On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
Asked
Active
Viewed 3,900 times
2 Answers
11
My understanding is that it is approximately the following from another Jeff Atwood post
t = (time of entry post) - (Dec 8, 2005)
x = upvotes - downvotes
y = {1 if x > 0, 0 if x = 0, -1 if x < 0)
z = {1 if x < 1, otherwise x}
log(z) + (y * t)/45000
-
2I don't like this solution - why do we need to fix a certain date and have an ever growing t? Why not change it so that t is age, and rearrange the algorithm so that a lower score is better. Voila, now some random pulled date has no influence. (More principle than necessity, but hey, that's me :) ) – jTresidder Dec 20 '08 at 16:16
-
7If X=0 then y=0, then z=0, and you get log(0) :( – Ofri Raviv Nov 15 '09 at 20:23
-
1@Ofri Raviv - Good catch! - You are right, the Z formula should have been less than "1" not less than "0". A typo that has been there for about 11 months and you are the first to point it out! - Thanks!! – Tall Jeff Nov 16 '09 at 03:20
6

Abhishek Mishra
- 5,002
- 8
- 36
- 38
-
@Ofri - I agree. The absolute value part of this is wrong I think. My answer (after fixing a typo you pointed out) is the intended answer. – Tall Jeff Nov 16 '09 at 03:23
-
Deadlink, answers like this shouldn't get upvoted without any piece of information in the answer besides an external link. – Skami Sep 01 '20 at 08:34