Calculating Better Rating Scores For Things Voted On

with the lower bound of the Wilson score confidence interval for a Bernoulli parameter

Formula for calculating the lower bound of the Wilson score confidence interval for a Bernoulli parameter

As the amazing Evan Miller explains in his popular article on”How not to sort by average rating” the most commonly found systems for ranking stuff on the web based on user up and down-votes are seriously flawed.

A better way to calculate a useful ranking score is to get the lower bound of the Wilson score confidence interval for a Bernoulli parameter. Essentially, this approach will balance the proportion of positive ratings (upvotes) with the possibility of dealing with small sample sizes.

Evan gives a much more detailed explanation (also as to why commonly used methods tend to fail), plus an example python implementation and a couple of SQL queries for it on his website. He also talks about possible other applications beyond simple ranking for let’s say the best comment on your website. So, I definitely recommend checking it out.

But for the impatient here a quick-n-dirty implementation for your next Node.js project:

Bookmark and ♥ for later reading :)

Show your support

Clapping shows how much you appreciated Matthias Gattermeier’s story.