
Ask HN: How is the avg in my HN profile calculated? - vijaydev
I currently have a karma of 1556 and an average of 2.55. I'm a HN'er for 509 days as on date. Clearly, the average is not straight forward. So, how is it calculated?
======
zck
I marked up the code pointed to by mrduncan with comments (a semicolon begins
a comment in Arc).

    
    
      (def comment-score (user)
        (aif ;; (aif test true-part false-part) ;; if test is true, assign its value
                                                ;; to the variable it and evaluate
                                                ;; true-part. Otherwise, evaluate
                                                ;; false-part.
             ;; This could alternately be awhen, and leave out nil at the end
             ;; of this function
         (check (nthcdr 5 (comments user 50))
      	  [len> _ 10]) ;; if the user has at least 15 comments, assign
                           ;; the comments numbered 6-50 to the variable it
         (avg ;; get the average of the list returned from the next line
          (cdr ;; take every score but the first
      	 (sort > ;; order the scores, so the "first" score mentioned above is
                     ;; the highest-scoring one
      	       (map !score (rem !deleted it))))) ;; get the scores of each comment
                                                     ;; as a list
         nil))
    

So it takes your comments numbered 6-50, throws out the highest-scoring one,
and averages them. This is assuming the code posted by mrduncan is still
correct (I'm not digging through a fresh copy of the source right now).

------
mrduncan

      ; Ignore the most recent 5 comments since they may still be gaining votes.  
      ; Also ignore the highest-scoring comment, since possibly a fluff outlier.
    

<http://github.com/nex3/arc/blob/master/news.arc#L2301>

It may be slightly different now, but probably not by much.

------
10ren
I've heard it described as basically the aveage of recent comments, with the
highest and lowest outliers thrown out. (I guess the formula's in the source
if you really want to know).

------
jogle
total karma / # comments = average?

