

Ask HN: Algorithm for ranking comments in a post - manidoraisamy

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?
======
ohashi
The other post mentions wilson confidence interval's. Here's the post I
learned it from: [http://www.evanmiller.org/how-not-to-sort-by-average-
rating....](http://www.evanmiller.org/how-not-to-sort-by-average-rating.html)

~~~
manidoraisamy
Thanks! Did I get these right?

\- 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?

------
lugg
[https://news.ycombinator.com/item?id=1781013](https://news.ycombinator.com/item?id=1781013)

[http://amix.dk/blog/post/19574](http://amix.dk/blog/post/19574)

------
manidoraisamy
Here is my current algorithm:

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

------
avargas
You could create something based off reddit's
[http://amix.dk/blog/post/19588](http://amix.dk/blog/post/19588)

