user6357859
user6357859

Reputation:

Modifying reddit's ranking algorithm to change content more often?

I use reddit's ranking algorithm on my site in order to rank what's "hot" and what's not. Here is a simple explanation of how reddit's ranking algorithm works:

https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-work-ef111e33d0d9#.igk62pe0x

Specifically, this part:

# Rewritten code from /r2/r2/lib/db/_sorts.pyx

from datetime import datetime, timedelta
from math import log

epoch = datetime(1970, 1, 1)

def epoch_seconds(date):
    td = date - epoch
    return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)

def score(ups, downs):
    return ups - downs

def hot(ups, downs, date):
    s = score(ups, downs)
    order = log(max(abs(s), 1), 10)
    sign = 1 if s > 0 else -1 if s < 0 else 0
    seconds = epoch_seconds(date) - 1134028003
    return round(sign * order + seconds / 45000, 7)

However, I found that, although this algorithm works very well, it doesn't change up content as often as I would like it to.

How can I modify the algorithm to do this? What numbers or parts of the algorithm would I need to modify in order for content on my site to change more frequently?

Upvotes: 0

Views: 202

Answers (1)

Vedang Mehta
Vedang Mehta

Reputation: 2254

Instead of dividing seconds by 45000, you can divide it by a smaller number so that recent posts will have more significant impact and the feed will change more frequently. You can also tweak with the base of the logarithmic function or use a function with a different growth rate like square root function.

Upvotes: 1

Related Questions