
Reverse Engineering the Hacker News Ranking Algorithm - foob
http://sangaline.com/post/reverse-engineering-the-hacker-news-ranking-algorithm/
======
nstj
Or you could just search for Paul Graham's posts[0] :)

> (= gravity* 1.8 timebase* 120 front-threshold* 1 nourl-factor* .4
> lightweight-factor* .17 gag-factor* .1)
    
    
        (def frontpage-rank (s (o scorefn realscore) (o gravity gravity*))
          (* (/ (let base (- (scorefn s) 1)
                  (if (> base 0) (expt base .8) base))
                (expt (/ (+ (item-age s) timebase*) 60) gravity))
             (if (no (in s!type 'story 'poll))  .8
                 (blank s!url)                  nourl-factor*
                 (mem 'bury s!keys)             .001
                                                (* (contro-factor s)
                                                   (if (mem 'gag s!keys)
                                                        gag-factor*
                                                       (lightweight s)
                                                        lightweight-factor*
                                                       1)))))
    

[0]:
[https://news.ycombinator.com/item?id=1781417](https://news.ycombinator.com/item?id=1781417)

~~~
overcast
Yeh I'm not sure why this is even a thing. I thought everyone knew that
algorithm at this point? Hell, I'm using the same thing on a couple projects.

~~~
foob
From the article:

 _I find this to be a particularly interesting question, not because I
actually care about the answer, but because it feels like the data should be
able to tell us the answer... My main goal was to tease out the ranking
algorithm from the data in a simple and elegant fashion. This made it a little
more interesting as an endeavor and hopefully makes it a more interesting read
as well._

You're right, the details of the algorithm aren't hugely interesting and are
generally available. The point here was to use the data to uncover it in a
somewhat novel way. Figuring things out can be fun in and of itself, even if
the answers are already available.

------
saycheese
Anyone interested in the topic of HN's ranking algorithm should look through
the HN's submission archives:

[https://hn.algolia.com/?query=How%20Hacker%20News%20ranking%...](https://hn.algolia.com/?query=How%20Hacker%20News%20ranking%20algorithm&sort=byPopularity&prefix&page=0&dateRange=all&type=story)

For example: [https://medium.com/hacking-and-gonzo/how-hacker-news-
ranking...](https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-
algorithm-works-1d9b0cf2c08d#.x86yaez0u)

------
jkchu
I wrote a piece a while back around implementing your own ranking algorithm.
Thought this audience might find it relevant/interesting.

[https://jkchu.com/2016/02/17/designing-and-implementing-a-
ra...](https://jkchu.com/2016/02/17/designing-and-implementing-a-ranking-
algorithm/)

------
foob
This is the article that was discussed in yesterday's "The stories that Hacker
News removes from the front page" [1]. After speaking with @dang, it sounds
like what happened with the original submission was that a moderator
accidentally put "(2010)" in the title and users flagged it because they
incorrectly thought it was old. He invited me to resubmit the article today to
allow for real discussion and to demonstrate that what happened to the first
submission was accidental.

I know that this analysis will get less attention than the one from yesterday,
but I personally find it far more interesting and hope that it can stand on
its own merits. I'll be around to answer any questions that might come up.

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

~~~
newbie2017
> it sounds like what happened with the original submission was that a
> moderator accidentally put "(2010)" in the title and users flagged it
> because they incorrectly thought it was old

mhm, I'm sure that's what really happened

~~~
dang
Which bit? The 2010 thing is precisely what happened. It was a case of sleep
deprivation, which is one lesson of how trying too hard to make this place
good can mess with a person.

The other bit was just my attempt to explain why users might have flagged the
post. User flags were what demoted its rank, and it isn't obvious why people
flagged it. There's also the issue that meta posts aren't great for HN in the
first place, but those rarely lack for upvotes.

~~~
saycheese
It would be nice if there was non-filtered view of HN available for users with
a rep above 500, much like the "show dead" option for user comments that have
been hidden. Basically allowing the submissions to be placed in the submission
rank as if their ranking was not pinged due to users flagging the submission.

~~~
mdekkers
I consume HN via an RSS feed, and it is an excellent experience. I don't need
a hivemind to do my filtering and thinking for me.

~~~
saycheese
To be fair, "the feed" (assume you mean the new feed) is populated by the
hive, it's just not sorted by votes or any other filter; of course unless the
mods remove/hide a submission for some reason.

~~~
mdekkers
I'm using /rss - I see a lot of stuff on there that subsequently gets flagged.

