Python implementation of the Wilson Score Interval?

前端 未结 5 582
-上瘾入骨i
-上瘾入骨i 2021-01-30 04:18

After reading How Not to Sort by Average Rating, I was curious if anyone has a Python implementation of a Lower bound of Wilson score confidence interval for a Bernoulli paramet

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-30 05:13

    I think this one has a wrong wilson call, because if you have 1 up 0 down you get NaN because you can't do a sqrt on the negative value.

    The correct one can be found when looking at the ruby example from the article How not to sort by average page:

    return ((phat + z*z/(2*n) - z * sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n))
    

提交回复
热议问题