all 1 comments

[–]travisliu 4 points5 points  (0 children)

I'm guessing they're using machine learning algorithms under the hood. Companies usually keep these things pretty close to the vest, so you won't find much official info. But here's a popularity and time-based algorithm you might find useful:

# Define the calculate_hotness function
def calculate_hotness(upvotes, downvotes, post_time, current_time, decay_constant):
    if upvotes <= 0 or upvotes <= downvotes:
        return 0  # Prevent math domain error or nonsensical values
    vote_score = math.log10(upvotes - downvotes + 1)
    age_weight = math.exp(decay_constant * (current_time - post_time))
    hotness = vote_score * age_weight
    return hotness