Ask HN: Algorithm for ranking comments in a post
I like the way HN displays comments based on how recent it is and its upvotes. I am building a leaderboard that ranks people and looking for a similar algorithm. Can you explain the algorithm?
- HN uses time decay to reduce score of older comments. While, Reddit uses wilson confidence interval to give provisional ranking for comments.
- Wilson confidence interval is useful when you want prospective score i.e. if comments are likely to get more upvotes in the future.
- For definitive score, (lets say, user played a game and has a score), HN's time decay will work better than wilson confidence interval?
DiffInDays = Today - Date_1970_1_1; // Number of days between Today and Jan 1, 1970.
Rank = DiffInDays + (Score/1000); // Score is the equivalent of upvotes.
// Sort by Rank