Thursday, May 16, 2019

Hacker News Metrics

Effects of gravity (G) and time (T)
Gravity and time have a significant impact on the score of an item. Generally these things hold true:
  • the score decreases as T increases, meaning that older items will get lower and lower scores
  • the score decreases much faster for older items if gravity is increased
To see this visually we can plot the algorithm to Wolfram Alpha.

How score is behaving over time
As you can see the score decreases a lot as time goes by, for example a 24 hour old item will have a very low score regardless of how many votes it got.

How gravity parameter behaves
As you can see by the graph the score decreases a lot faster the larger the gravity is.

def calculate_score(votes, item_hour_age, gravity=1.8):
    return (votes - 1) / pow((item_hour_age+2), gravity)