O

Services

Case studies

Contact

13.12.21

How not to sort by average rating

featured image thumbnail for post How not to sort by average rating

You are a web programmer. You have users. Your users rate stuff on your site. You want to put the highest-rated stuff at the top and lowest-rated at the bottom. You need some sort of “score” to sort by.

You're probably doing it wrong. Most simple approaches to the problem fail to take into account the number of scores. Using the average gives bad answers when some items have few ratings. A single five star review (average = 5) will look better than one that has 999 five stars and one four star (average = 4.999). For a better way, have a look at this article (from a few years back). You should use the lower bound of Wilson score confidence interval for a Bernoulli parameter. In R its just base::binom.confint, in Python you can use proportion_confint from statsmodels.

←Previous: Will cloud providers just rent hardware?

Next: Stop using boxplots→


Keep up with the latest developments in data science. One email per month.

ortom logoortom logoortom logoortom logo

©2025

LINKEDIN

CLUTCH.CO

TERMS & PRIVACY