在teahour听到Hack News网站的算法,在medium找到了一篇详细的文章:
How Hacker News ranking algorithm works
算法公式如下:
Score = (P-1) / (T+2)^G
where,
P = points of an item (and -1 is to negate submitters vote) | item得分点,-1是减去投稿者的一分
T = time since submission (in hours) | 时间
G = Gravity, defaults to 1.8 in news.arc | 重力,默认是1.8
文章在 WolframAlpha 有绘出在votes分别为30,60,200下的图形:
ploting query
plot( (30 - 1) / (t + 2)^1.8, (60 - 1) / (t + 2)^1.8, (200 - 1) / (t + 2)^1.8 ) where t=0..24
``
![](https://d262ilb51hltx0.cloudfront.net/max/800/0*hpwwM81bhd6uRSd4.gif)
自己用excel画了下,votes也就是fav设置为5,10,20,50,100:
![输入图片说明](https://static.oschina.net/uploads/img/201608/10173942_YAXS.jpg "在这里输入图片标题")
可以大概看出,fav较低的大概和2小时前的fav高一级的持平。
###### G和T的作用
Gravity越高,time对score影响越大,意味着older的items会得到更低的分数。