This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute the comment score | |
def compute_comment_score(c) | |
upcount = (c['up'] ? c['up'].length : 0) | |
downcount = (c['down'] ? c['down'].length : 0) | |
n = upcount + downcount | |
return 0 if n==0 | |
#1.6 = 95%,1.0 = 85% | |
z = 1.6 | |
phat = Float(ups) / n | |
Math.sqrt(phat+z*z/(2*n)-z*((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n) |
NewerOlder