How to implement the Bayesian average algorithm for a binary rating system

gath picture gath · Jul 1, 2010 · Viewed 7.1k times · Source

I have a system where people can up vote or down vote an item and I want to display the results of that as a 5 star rating.

I have been trying use the Bayesian Rating algorithm explained here and here with no success.

For example: I have three items (A, B and C) in my database:

A = 500 UP and 500 down votes B = 0 UP and 1000 down votes C = 0 UP and 1000 down votes

How do i calculate the Bayesian average rating for each item so that it has a score on a scale of 1 to 5?

Answer

Nick Johnson picture Nick Johnson · Jul 1, 2010

This blog post, How Not To Sort By Average Rating, describes exactly your situation, and how to solve it using a Wilson Score confidence interval. Reddit used this to good effect.