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.
+6
A:
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
Tall Jeff
2008-08-28 14:26:05
I 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
2008-12-20 16:16:33
If X=0 then y=0, then z=0, and you get log(0) :(
Ofri Raviv
2009-11-15 20:23:42
@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
2009-11-16 03:20:57
nice work InSciTek Jeff
baeltazor
2009-11-16 04:12:36
A:
@InSciTek Jeff Are you sure?
That seems to get a higher value to older posts. The older the post, the higher the value.
Jorge Córdoba
2008-08-28 14:32:54
Put the flux capacitor down, and step away from the Delorean - any date after Dec 8 2005 will give you a positive t. The further from that date, the higher the score, ie newest score higher.
jTresidder
2008-12-20 16:10:46
WTF?! This algorithm smells so bad, *plus* it doesn't work.If x = -1,000,000, then y = -1, z = +6. If Ts is small enough, you'd have a positive value! maybe if you remove the abs() from x in the definition of z it will start making some sense, but still, its *way* too complex for what its trying to do.
Ofri Raviv
2009-11-15 20:30:29
@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
2009-11-16 03:23:08