Administrators · Legacy archive

Submission Ranking Formula

Started by Strolen Nov 30, 2013 3 posts Locked

  1. Submission Ranking Formula

    #1
    Code monkeys

    You may have your own algorithms and such, but found this a good read and curious how it might be used here....

    Frontpage date rank is fine with me, but another page with ranked listings based on time, votes and comments might be fun at least.

    http://www.righto.com/2013/11/how-hacker-news-ranking-really-works.html

    I won't even pretend to to be able to translate that exact code to php, but the formula itself is fairly straightforward.

    (= gravity* 1.8 timebase* 120 front-threshold* 1
      nourl-factor* .4 lightweight-factor* .3 )

    (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))  1
            (blank s!url)                  nourl-factor*
            (lightweight s)                (min lightweight-factor*
                                                (contro-factor s))
                                            (contro-factor s))))
  2. Re: Submission Ranking Formula

    #2
    Lisp. @!#$.

    Edit:

    Okay, so it's Arc, not Lisp. Still a recognizable dialect. Reading the article, we'd be better off just implementing the simplified formula he provides, instead of trying to adapt the Arc code. Here's a PHP version:


    function score_rank($votes, $age_in_hours, $gravity=1.8) {
        $numerator = pow(($votes - 1), .8);
        $denominator = pow(($age_in_hours + 2), $gravity);
        $score = $numerator / $denominator;
        return $score;
    }


    http://www.righto.com/2009/06/how-does-newsyc-ranking-work.html helps to explain exactly what the parameters mean, which lets us simplify down. We don't need any of the penalty factors that they included, because we don't have to deal with the same issues they do. Thus, this simplified formula would work well for us.
  3. Re: Submission Ranking Formula

    #3
    Was wondering why that code seemed so hard to follow.  Do you have a link for the pseudo code?

    I did scheme like 20 years ago, which is related, but, yuck.

Administrators · All categories · Guildhall