I'm going to have a mySQL table with elements in it and would like to rank them in the same manner than Reddit but not quite. I'd like to know how to add or remove importance to a variable in my ranking algorithm.
For instance, what I have is a time (a timestamp, so a huge value) and a number of upvotes (a smallish value, under 50). How do I give more importance to the upvotes and less to the time?
1 Answer 1
Multiply each value with a weight, the timestamp will be small while the number of upvotes will be large.
-
Some something like
rank = 0.001*timestamp + 10*upvotes
?Farid– Farid2014年08月31日 23:14:12 +00:00Commented Aug 31, 2014 at 23:14 -
@Farid exactly like that.ratchet freak– ratchet freak2014年08月31日 23:15:31 +00:00Commented Aug 31, 2014 at 23:15
-
I suspect you really want a factor proportional to
(now - timestamp)
, and not directlytimestamp
.aecolley– aecolley2014年09月01日 01:38:01 +00:00Commented Sep 1, 2014 at 1:38 -
@aecolley depends if he want older to be more important or less important: now-timestamp vs timestamp-epochratchet freak– ratchet freak2014年09月01日 07:43:15 +00:00Commented Sep 1, 2014 at 7:43
-
@aecolley @ratchet freak I want older to be less important. Is it
timestamp-epoch
?Farid– Farid2014年09月01日 14:54:35 +00:00Commented Sep 1, 2014 at 14:54